Coder Social home page Coder Social logo

java-spanner's Introduction

Google Cloud Spanner Client for Java

Java idiomatic client for Cloud Spanner.

Maven Stability

Quickstart

If you are using Maven with BOM, add this to your pom.xml file:

<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>libraries-bom</artifactId>
      <version>26.43.0</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>

<dependencies>
  <dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-spanner</artifactId>
  </dependency>

If you are using Maven without the BOM, add this to your dependencies:

<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-spanner</artifactId>
  <version>6.71.0</version>
</dependency>

If you are using Gradle 5.x or later, add this to your dependencies:

implementation platform('com.google.cloud:libraries-bom:26.43.0')

implementation 'com.google.cloud:google-cloud-spanner'

If you are using Gradle without BOM, add this to your dependencies:

implementation 'com.google.cloud:google-cloud-spanner:6.71.0'

If you are using SBT, add this to your dependencies:

libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.71.0"

Authentication

See the Authentication section in the base directory's README.

Authorization

The client application making API calls must be granted authorization scopes required for the desired Cloud Spanner APIs, and the authenticated principal must have the IAM role(s) required to access GCP resources using the Cloud Spanner API calls.

Getting Started

Prerequisites

You will need a Google Cloud Platform Console project with the Cloud Spanner API enabled. You will need to enable billing to use Google Cloud Spanner. Follow these instructions to get your project set up. You will also need to set up the local development environment by installing the Google Cloud Command Line Interface and running the following commands in command line: gcloud auth login and gcloud config set project [YOUR PROJECT ID].

Installation and setup

You'll need to obtain the google-cloud-spanner library. See the Quickstart section to add google-cloud-spanner as a dependency in your code.

About Cloud Spanner

Cloud Spanner is a fully managed, mission-critical, relational database service that offers transactional consistency at global scale, \nschemas, SQL (ANSI 2011 with extensions), and automatic, synchronous replication \nfor high availability.\n\nBe sure to activate the Cloud Spanner API on the Developer's Console to\nuse Cloud Spanner from your project.

See the Cloud Spanner client library docs to learn how to use this Cloud Spanner Client Library.

Calling Cloud Spanner

Here is a code snippet showing a simple usage example. Add the following imports at the top of your file:

import com.google.cloud.spanner.DatabaseClient;
import com.google.cloud.spanner.DatabaseId;
import com.google.cloud.spanner.ResultSet;
import com.google.cloud.spanner.Spanner;
import com.google.cloud.spanner.SpannerOptions;
import com.google.cloud.spanner.Statement;

Then, to make a query to Spanner, use the following code:

// Instantiates a client
SpannerOptions options = SpannerOptions.newBuilder().build();
Spanner spanner = options.getService();
String instance = "my-instance";
String database = "my-database";
try {
  // Creates a database client
  DatabaseClient dbClient = spanner.getDatabaseClient(
    DatabaseId.of(options.getProjectId(), instance, database));
  // Queries the database
  try (ResultSet resultSet = dbClient.singleUse().executeQuery(Statement.of("SELECT 1"))) {
    // Prints the results
    while (resultSet.next()) {
      System.out.printf("%d\n", resultSet.getLong(0));
    }
  }
} finally {
  // Closes the client which will free up the resources used
  spanner.close();
}

Complete source code

In DatabaseSelect.java we put together all the code shown above in a single program.

Session Pool

The Cloud Spanner client maintains a session pool, as sessions are expensive to create and are intended to be long-lived. The client automatically takes a session from the pool and uses this executing queries and transactions. See Session Pool and Channel Pool Configuration for in-depth background information about sessions and gRPC channels and how these are handled in the Cloud Spanner Java client.

Metrics

Available client-side metrics:

  • spanner/max_in_use_sessions: This returns the maximum number of sessions that have been in use during the last maintenance window interval, so as to provide an indication of the amount of activity currently in the database.

  • spanner/max_allowed_sessions: This shows the maximum number of sessions allowed.

  • spanner/num_sessions_in_pool: This metric allows users to see instance-level and database-level data for the total number of sessions in the pool at this very moment.

  • spanner/num_acquired_sessions: This metric allows users to see the total number of acquired sessions.

  • spanner/num_released_sessions: This metric allows users to see the total number of released (destroyed) sessions.

  • spanner/get_session_timeouts: This gives you an indication of the total number of get session timed-out instead of being granted (the thread that requested the session is placed in a wait queue where it waits until a session is released into the pool by another thread) due to pool exhaustion since the server process started.

  • spanner/gfe_latency: This metric shows latency between Google's network receiving an RPC and reading back the first byte of the response.

  • spanner/gfe_header_missing_count: This metric shows the number of RPC responses received without the server-timing header, most likely indicating that the RPC never reached Google's network.

Instrument with OpenTelemetry

Cloud Spanner client supports OpenTelemetry Metrics, which gives insight into the client internals and aids in debugging/troubleshooting production issues. OpenTelemetry metrics will provide you with enough data to enable you to spot, and investigate the cause of any unusual deviations from normal behavior.

All Cloud Spanner Metrics are prefixed with spanner/ and uses cloud.google.com/java as Instrumentation Scope. The metrics will be tagged with:

  • database: the target database name.
  • instance_id: the instance id of the target Spanner instance.
  • client_id: the user defined database client id.

By default, the functionality is disabled. You need to add OpenTelemetry dependencies, enable OpenTelemetry metrics and must configure the OpenTelemetry with appropriate exporters at the startup of your application:

OpenTelemetry Dependencies

If you are using Maven, add this to your pom.xml file

<dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-sdk</artifactId>
      <version>{opentelemetry.version}</version>
</dependency>
<dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-sdk-metrics</artifactId>
      <version>{opentelemetry.version}</version>
</dependency>
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-exporter-otlp</artifactId>
    <version>{opentelemetry.version}</version>
</dependency>

If you are using Gradle, add this to your dependencies

compile 'io.opentelemetry:opentelemetry-sdk:{opentelemetry.version}'
compile 'io.opentelemetry:opentelemetry-sdk-metrics:{opentelemetry.version}'
compile 'io.opentelemetry:opentelemetry-exporter-oltp:{opentelemetry.version}'

OpenTelemetry Configuration

By default, all metrics are disabled. To enable metrics and configure the OpenTelemetry follow below:

// Enable OpenTelemetry metrics before injecting OpenTelemetry object.
SpannerOptions.enableOpenTelemetryMetrics();

SdkMeterProvider sdkMeterProvider = SdkMeterProvider.builder()
// Use Otlp exporter or any other exporter of your choice.
  .registerMetricReader(PeriodicMetricReader.builder(OtlpGrpcMetricExporter.builder().build())
  .build())
  .build();

OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
        .setMeterProvider(sdkMeterProvider)
        .build()

SpannerOptions options = SpannerOptions.newBuilder()
// Inject OpenTelemetry object via Spanner Options or register OpenTelemetry object as Global
  .setOpenTelemetry(openTelemetry)
  .build();

Spanner spanner = options.getService();

OpenTelemetry SQL Statement Tracing

The OpenTelemetry traces that are generated by the Java client include any request and transaction tags that have been set. The traces can also include the SQL statements that are executed and the name of the thread that executes the statement. Enable this with the enableExtendedTracing option:

SpannerOptions options = SpannerOptions.newBuilder()
  .setOpenTelemetry(openTelemetry)
  .setEnableExtendedTracing(true)
  .build();

This option can also be enabled by setting the environment variable SPANNER_ENABLE_EXTENDED_TRACING=true.

OpenTelemetry API Tracing

You can enable tracing of each API call that the Spanner client executes with the enableApiTracing option. These traces also include any retry attempts for an API call:

SpannerOptions options = SpannerOptions.newBuilder()
.setOpenTelemetry(openTelemetry)
.setEnableApiTracing(true)
.build();

This option can also be enabled by setting the environment variable SPANNER_ENABLE_API_TRACING=true.

Note: The attribute keys that are used for additional information about retry attempts and the number of requests might change in a future release.

Instrument with OpenCensus

Note: OpenCensus project is deprecated. See Sunsetting OpenCensus. We recommend migrating to OpenTelemetry, the successor project.

Cloud Spanner client supports Opencensus Metrics, which gives insight into the client internals and aids in debugging/troubleshooting production issues. OpenCensus metrics will provide you with enough data to enable you to spot, and investigate the cause of any unusual deviations from normal behavior.

All Cloud Spanner Metrics are prefixed with cloud.google.com/java/spanner

The metrics are tagged with:

  • database: the target database name.
  • instance_id: the instance id of the target Spanner instance.
  • client_id: the user defined database client id.
  • library_version: the version of the library that you're using.

By default, the functionality is disabled. You need to include opencensus-impl dependency to collect the data and exporter dependency to export to backend.

Click here for more information.

OpenCensus Dependencies

If you are using Maven, add this to your pom.xml file

<dependency>
  <groupId>io.opencensus</groupId>
  <artifactId>opencensus-impl</artifactId>
  <version>0.30.0</version>
  <scope>runtime</scope>
</dependency>
<dependency>
  <groupId>io.opencensus</groupId>
  <artifactId>opencensus-exporter-stats-stackdriver</artifactId>
  <version>0.30.0</version>
</dependency>

If you are using Gradle, add this to your dependencies

compile 'io.opencensus:opencensus-impl:0.30.0'
compile 'io.opencensus:opencensus-exporter-stats-stackdriver:0.30.0'

Configure the OpenCensus Exporter

At the start of your application configure the exporter:

import io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter;
// Enable OpenCensus exporters to export metrics to Stackdriver Monitoring.
// Exporters use Application Default Credentials to authenticate.
// See https://developers.google.com/identity/protocols/application-default-credentials
// for more details.
// The minimum reporting period for Stackdriver is 1 minute.
StackdriverStatsExporter.createAndRegister();

Enable RPC Views

By default, all session metrics are enabled. To enable RPC views, use either of the following method:

// Register views for GFE metrics, including gfe_latency and gfe_header_missing_count.
SpannerRpcViews.registerGfeLatencyAndHeaderMissingCountViews();

// Register GFE Latency view. 
SpannerRpcViews.registerGfeLatencyView();

// Register GFE Header Missing Count view.
SpannerRpcViews.registerGfeHeaderMissingCountView();

Traces

Cloud Spanner client supports OpenTelemetry Traces, which gives insight into the client internals and aids in debugging/troubleshooting production issues.

By default, the functionality is disabled. You need to add OpenTelemetry dependencies, enable OpenTelemetry traces and must configure the OpenTelemetry with appropriate exporters at the startup of your application.

OpenTelemetry Dependencies

If you are using Maven, add this to your pom.xml file

<dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-sdk</artifactId>
      <version>{opentelemetry.version}</version>
</dependency>
<dependency>
      <groupId>io.opentelemetry</groupId>
      <artifactId>opentelemetry-sdk-trace</artifactId>
      <version>{opentelemetry.version}</version>
</dependency>
<dependency>
    <groupId>io.opentelemetry</groupId>
    <artifactId>opentelemetry-exporter-otlp</artifactId>
    <version>{opentelemetry.version}</version>
</dependency>

If you are using Gradle, add this to your dependencies

compile 'io.opentelemetry:opentelemetry-sdk:{opentelemetry.version}'
compile 'io.opentelemetry:opentelemetry-sdk-trace:{opentelemetry.version}'
compile 'io.opentelemetry:opentelemetry-exporter-oltp:{opentelemetry.version}'

OpenTelemetry Configuration

Note: Enabling OpenTelemetry traces will automatically disable OpenCensus traces.

// Enable OpenTelemetry traces
SpannerOptions.enableOpenTelemetryTraces();

// Create a new tracer provider
SdkTracerProvider sdkTracerProvider = SdkTracerProvider.builder()
      // Use Otlp exporter or any other exporter of your choice.
      .addSpanProcessor(SimpleSpanProcessor.builder(OtlpGrpcSpanExporter
          .builder().build()).build())
          .build();


OpenTelemetry openTelemetry = OpenTelemetrySdk.builder()
        .setTracerProvider(sdkTracerProvider)
        .build()

SpannerOptions options = SpannerOptions.newBuilder()
// Inject OpenTelemetry object via Spanner Options or register OpenTelmetry object as Global
  .setOpenTelemetry(openTelemetry)
  .build();

Spanner spanner = options.getService();

OpenTelemetry SQL Statement Tracing

The OpenTelemetry traces that are generated by the Java client include any request and transaction tags that have been set. The traces can also include the SQL statements that are executed and the name of the thread that executes the statement. Enable this with the enableExtendedTracing option:

SpannerOptions options = SpannerOptions.newBuilder()
  .setOpenTelemetry(openTelemetry)
  .setEnableExtendedTracing(true)
  .build();

This option can also be enabled by setting the environment variable SPANNER_ENABLE_EXTENDED_TRACING=true.

OpenTelemetry API Tracing

You can enable tracing of each API call that the Spanner client executes with the enableApiTracing option. These traces also include any retry attempts for an API call:

SpannerOptions options = SpannerOptions.newBuilder()
.setOpenTelemetry(openTelemetry)
.setEnableApiTracing(true)
.build();

This option can also be enabled by setting the environment variable SPANNER_ENABLE_API_TRACING=true.

Note: The attribute keys that are used for additional information about retry attempts and the number of requests might change in a future release.

Migrate from OpenCensus to OpenTelemetry

Using the OpenTelemetry OpenCensus Bridge, you can immediately begin exporting your metrics and traces with OpenTelemetry

Disable OpenCensus metrics

Disable OpenCensus metrics for Spanner by including the following code if you still possess OpenCensus dependencies and exporter.

SpannerOptions.disableOpenCensusMetrics();

Disable OpenCensus traces

Enabling OpenTelemetry traces for Spanner will automatically disable OpenCensus traces.

SpannerOptions.enableOpenTelemetryTraces();

Remove OpenCensus Dependencies and Code

Remove any OpenCensus-related code and dependencies from your codebase if all your dependencies are ready to move to OpenTelemetry.

  • Remove the OpenCensus Exporters which were configured here
  • Remove SpannerRPCViews reference which were configured here
  • Remove the OpenCensus dependencies which were added here

Update your Dashboards and Alerts

Update your dashboards and alerts to reflect below changes

  • Metrics name : cloud.google.com/java prefix has been removed from OpenTelemery metrics and instead has been added as Instrumenation Scope.
  • Metrics namespace : OpenTelmetry exporters uses workload.googleapis.com namespace opposed to custom.googleapis.com with OpenCensus.

Samples

Samples are in the samples/ directory.

Sample Source Code Try it
Database Operations source code Open in Cloud Shell
Instance Operations source code Open in Cloud Shell
Native Image Spanner Sample source code Open in Cloud Shell
Add And Drop Database Role source code Open in Cloud Shell
Add Json Column Sample source code Open in Cloud Shell
Add Jsonb Column Sample source code Open in Cloud Shell
Add Numeric Column Sample source code Open in Cloud Shell
Add Proto Column Sample source code Open in Cloud Shell
Alter Sequence Sample source code Open in Cloud Shell
Alter Table With Foreign Key Delete Cascade Sample source code Open in Cloud Shell
Async Dml Example source code Open in Cloud Shell
Async Query Example source code Open in Cloud Shell
Async Query To List Async Example source code Open in Cloud Shell
Async Read Example source code Open in Cloud Shell
Async Read Only Transaction Example source code Open in Cloud Shell
Async Read Row Example source code Open in Cloud Shell
Async Read Using Index Example source code Open in Cloud Shell
Async Runner Example source code Open in Cloud Shell
Async Transaction Manager Example source code Open in Cloud Shell
Batch Sample source code Open in Cloud Shell
Batch Write At Least Once Sample source code Open in Cloud Shell
Copy Backup Sample source code Open in Cloud Shell
Create Backup With Encryption Key source code Open in Cloud Shell
Create Database With Default Leader Sample source code Open in Cloud Shell
Create Database With Encryption Key source code Open in Cloud Shell
Create Database With Version Retention Period Sample source code Open in Cloud Shell
Create Instance Config Sample source code Open in Cloud Shell
Create Instance Example source code Open in Cloud Shell
Create Instance With Autoscaling Config Example source code Open in Cloud Shell
Create Instance With Processing Units Example source code Open in Cloud Shell
Create Sequence Sample source code Open in Cloud Shell
Create Table With Foreign Key Delete Cascade Sample source code Open in Cloud Shell
Custom Timeout And Retry Settings Example source code Open in Cloud Shell
Delete Instance Config Sample source code Open in Cloud Shell
Delete Using Dml Returning Sample source code Open in Cloud Shell
Directed Read Sample source code Open in Cloud Shell
Drop Foreign Key Constraint Delete Cascade Sample source code Open in Cloud Shell
Drop Sequence Sample source code Open in Cloud Shell
Enable Fine Grained Access source code Open in Cloud Shell
Get Commit Stats Sample source code Open in Cloud Shell
Get Database Ddl Sample source code Open in Cloud Shell
Get Instance Config Sample source code Open in Cloud Shell
Insert Using Dml Returning Sample source code Open in Cloud Shell
List Database Roles source code Open in Cloud Shell
List Databases Sample source code Open in Cloud Shell
List Instance Config Operations Sample source code Open in Cloud Shell
List Instance Configs Sample source code Open in Cloud Shell
Pg Alter Sequence Sample source code Open in Cloud Shell
Pg Async Query To List Async Example source code Open in Cloud Shell
Pg Async Runner Example source code Open in Cloud Shell
Pg Async Transaction Manager Example source code Open in Cloud Shell
Pg Batch Dml Sample source code Open in Cloud Shell
Pg Case Sensitivity Sample source code Open in Cloud Shell
Pg Create Sequence Sample source code Open in Cloud Shell
Pg Delete Using Dml Returning Sample source code Open in Cloud Shell
Pg Drop Sequence Sample source code Open in Cloud Shell
Pg Insert Using Dml Returning Sample source code Open in Cloud Shell
Pg Interleaved Table Sample source code Open in Cloud Shell
Pg Partitioned Dml Sample source code Open in Cloud Shell
Pg Query With Numeric Parameter Sample source code Open in Cloud Shell
Pg Spanner Sample source code Open in Cloud Shell
Pg Update Using Dml Returning Sample source code Open in Cloud Shell
Query Information Schema Database Options Sample source code Open in Cloud Shell
Query With Json Parameter Sample source code Open in Cloud Shell
Query With Jsonb Parameter Sample source code Open in Cloud Shell
Query With Numeric Parameter Sample source code Open in Cloud Shell
Query With Proto Parameter Sample source code Open in Cloud Shell
Quickstart Sample source code Open in Cloud Shell
Read Data With Database Role source code Open in Cloud Shell
Restore Backup With Encryption Key source code Open in Cloud Shell
Set Max Commit Delay Sample source code Open in Cloud Shell
Singer Proto source code Open in Cloud Shell
Spanner Sample source code Open in Cloud Shell
Statement Timeout Example source code Open in Cloud Shell
Tag Sample source code Open in Cloud Shell
Tracing Sample source code Open in Cloud Shell
Transaction Timeout Example source code Open in Cloud Shell
Update Database Sample source code Open in Cloud Shell
Update Database With Default Leader Sample source code Open in Cloud Shell
Update Instance Config Sample source code Open in Cloud Shell
Update Json Data Sample source code Open in Cloud Shell
Update Jsonb Data Sample source code Open in Cloud Shell
Update Numeric Data Sample source code Open in Cloud Shell
Update Proto Data Sample source code Open in Cloud Shell
Update Proto Data Sample Using Dml source code Open in Cloud Shell
Update Using Dml Returning Sample source code Open in Cloud Shell
Add And Drop Database Role source code Open in Cloud Shell
Add Json Column Sample source code Open in Cloud Shell
Add Jsonb Column Sample source code Open in Cloud Shell
Add Numeric Column Sample source code Open in Cloud Shell
Alter Sequence Sample source code Open in Cloud Shell
Alter Table With Foreign Key Delete Cascade Sample source code Open in Cloud Shell
Copy Backup Sample source code Open in Cloud Shell
Create Backup With Encryption Key source code Open in Cloud Shell
Create Database With Default Leader Sample source code Open in Cloud Shell
Create Database With Encryption Key source code Open in Cloud Shell
Create Database With Version Retention Period Sample source code Open in Cloud Shell
Create Instance Config Sample source code Open in Cloud Shell
Create Instance Example source code Open in Cloud Shell
Create Instance With Autoscaling Config Example source code Open in Cloud Shell
Create Instance With Processing Units Example source code Open in Cloud Shell
Create Sequence Sample source code Open in Cloud Shell
Create Table With Foreign Key Delete Cascade Sample source code Open in Cloud Shell
Delete Instance Config Sample source code Open in Cloud Shell
Drop Foreign Key Constraint Delete Cascade Sample source code Open in Cloud Shell
Drop Sequence Sample source code Open in Cloud Shell
Enable Fine Grained Access source code Open in Cloud Shell
Get Database Ddl Sample source code Open in Cloud Shell
Get Instance Config Sample source code Open in Cloud Shell
List Database Roles source code Open in Cloud Shell
List Databases Sample source code Open in Cloud Shell
List Instance Config Operations Sample source code Open in Cloud Shell
List Instance Configs Sample source code Open in Cloud Shell
Pg Alter Sequence Sample source code Open in Cloud Shell
Pg Case Sensitivity Sample source code Open in Cloud Shell
Pg Create Sequence Sample source code Open in Cloud Shell
Pg Drop Sequence Sample source code Open in Cloud Shell
Pg Interleaved Table Sample source code Open in Cloud Shell
Pg Spanner Sample source code Open in Cloud Shell
Restore Backup With Encryption Key source code Open in Cloud Shell
Spanner Sample source code Open in Cloud Shell
Update Database Sample source code Open in Cloud Shell
Update Database With Default Leader Sample source code Open in Cloud Shell
Update Instance Config Sample source code Open in Cloud Shell

Troubleshooting

To get help, follow the instructions in the shared Troubleshooting document.

Transport

Cloud Spanner uses gRPC for the transport layer.

Supported Java Versions

Java 8 or above is required for using this client.

Google's Java client libraries, Google Cloud Client Libraries and Google Cloud API Libraries, follow the Oracle Java SE support roadmap (see the Oracle Java SE Product Releases section).

For new development

In general, new feature development occurs with support for the lowest Java LTS version covered by Oracle's Premier Support (which typically lasts 5 years from initial General Availability). If the minimum required JVM for a given library is changed, it is accompanied by a semver major release.

Java 11 and (in September 2021) Java 17 are the best choices for new development.

Keeping production systems current

Google tests its client libraries with all current LTS versions covered by Oracle's Extended Support (which typically lasts 8 years from initial General Availability).

Legacy support

Google's client libraries support legacy versions of Java runtimes with long term stable libraries that don't receive feature updates on a best efforts basis as it may not be possible to backport all patches.

Google provides updates on a best efforts basis to apps that continue to use Java 7, though apps might need to upgrade to current versions of the library that supports their JVM.

Where to find specific information

The latest versions and the supported Java versions are identified on the individual GitHub repository github.com/GoogleAPIs/java-SERVICENAME and on google-cloud-java.

Versioning

This library follows Semantic Versioning.

Contributing

Contributions to this library are always welcome and highly encouraged.

See CONTRIBUTING for more information how to get started.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See Code of Conduct for more information.

License

Apache 2.0 - See LICENSE for more information.

CI Status

Java Version Status
Java 8 Kokoro CI
Java 8 OSX Kokoro CI
Java 8 Windows Kokoro CI
Java 11 Kokoro CI

Java is a registered trademark of Oracle and/or its affiliates.

java-spanner's People

Contributors

andreamlin avatar arpan14 avatar chingor13 avatar dependabot[bot] avatar garrettjonesgoogle avatar gauravpurohit06 avatar gcf-owl-bot[bot] avatar harshachinta avatar jesselovelace avatar jsimonweb avatar kolea2 avatar mayurkale22 avatar mohanli-ml avatar mpeddada1 avatar neenu1995 avatar nithinsujir avatar olavloite avatar pongad avatar rahul2393 avatar rajatbhatta avatar release-please[bot] avatar renovate-bot avatar skuruppu avatar surbhigarg92 avatar suztomo avatar thiagotnunes avatar vam-google avatar yihanzhen avatar yoshi-automation avatar zoercai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-spanner's Issues

InstanceId.of(String, String) accepts null project, but InstanceId.equals doesn't handle null

InstanceId.equals threw a NullPointerException when I accidentally set the project to null. I would have expected the exception to be thrown earlier, in the factory method.

Code example

@Test
public void test() {
  InstanceId instance1 = InstanceId.of("project", "instance-1");
  InstanceId instance2 = InstanceId.of(null, "instance-2");
  System.out.println(instance1.equals(instance2));
}

Stack trace

java.lang.NullPointerException
	at com.google.cloud.spanner.InstanceId.equals(InstanceId.java:66)
...

EDIT: I used google-cloud-spanner version 1.52.0.

Attempting to read from a non-existent database can create many distinct client IDs in the session metrics

I noticed that calling Spanner.getDatabaseClient with a non-existent database and then trying to read from the database can cause new client IDs to appear in the OpenCensus session metrics. The client IDs for the non-existent database seem problematic because they can cause the size of the metrics to grow.

Here is a simplified reproduction:

google-cloud-spanner version: 1.54.0
opencensus-java version: 0.26.0

import com.google.cloud.spanner.DatabaseId;
import com.google.cloud.spanner.InstanceConfigId;
import com.google.cloud.spanner.InstanceId;
import com.google.cloud.spanner.InstanceInfo;
import com.google.cloud.spanner.Key;
import com.google.cloud.spanner.Spanner;
import com.google.cloud.spanner.SpannerOptions;
import io.opencensus.exporter.stats.stackdriver.StackdriverStatsExporter;
import java.util.Arrays;
import org.junit.Test;

public class ClientIdTest {
  @Test
  public void testClientId() throws Exception {
    StackdriverStatsExporter.createAndRegister();
    Spanner spanner = SpannerOptions.getDefaultInstance().getService();
    String projectId = spanner.getOptions().getProjectId();
    InstanceId instanceId = InstanceId.of(projectId, "my-instance");
    InstanceConfigId instanceConfigId = InstanceConfigId.of(projectId, "regional-us-central1");
    spanner
        .getInstanceAdminClient()
        .createInstance(
            InstanceInfo.newBuilder(instanceId)
                .setInstanceConfigId(instanceConfigId)
                .setDisplayName("my-instance")
                .setNodeCount(1)
                .build())
        .get();
    DatabaseId databaseId = DatabaseId.of(instanceId, "my-database");

    for (int i = 0; i < 100; i++) {
      try {
        spanner
            .getDatabaseClient(databaseId)
            .singleUse()
            .readRow("MyTable", Key.of(0), Arrays.asList("MyColumn"));
      } catch (Exception e) {
        // ignore
      }
    }
    Thread.sleep(300_000);
  }
}

The metrics exported to Stackdriver contain 100 client IDs. For example, here is in_use_sessions:

session-metrics

session-metrics-2

spanner: "OVERKILLED java.lang.IllegalStateException: refCount dropped below zero" warning

I have seen a few reports of warning messages polluting error logs.

Environment details

  1. Specify the API at the beginning of the title. For example, "BigQuery: ...").
    Spanner
  2. OS type and version: Linux but version unknown
  3. Java version: Unknown
  4. spanner version(s): 1.43.0

Steps to reproduce

I haven't reproduced this yet but I suspect this happens when an error occurs during ResumableStreamIterator.computeNext(). The trace span is ended with TraceUtil.endSpanWithFailure(span, e) but then when the stream iterator is closed, the code attempts to end the span again.

Stack trace

WARNING: <span:26a180bf406e2db9, parent:4479af252f884e07, trace:842cc1d5df736326, mask:ffffffff98000080, name:CloudSpannerOperation.ExecuteStreamingQuery>: OVERKILLED
java.lang.IllegalStateException: refCount dropped below zero
	at com.google.tracing.TraceContext.unRef(TraceContext.java:799)
	at com.google.perftools.opencensus.trace.SpanImpl.end(SpanImpl.java:237)
	at io.opencensus.trace.Span.end(Span.java:244)
	at com.google.cloud.spanner.AbstractResultSet$ResumableStreamIterator.close(AbstractResultSet.java:850)
	at com.google.cloud.spanner.AbstractResultSet$GrpcValueIterator.close(AbstractResultSet.java:285)
	at com.google.cloud.spanner.AbstractResultSet$GrpcResultSet.close(AbstractResultSet.java:133)
	at com.google.cloud.spanner.AbstractResultSet$GrpcResultSet.yieldError(AbstractResultSet.java:144)
	at com.google.cloud.spanner.AbstractResultSet$GrpcResultSet.next(AbstractResultSet.java:121)
	at com.google.cloud.spanner.ForwardingResultSet.next(ForwardingResultSet.java:47)
	at com.google.cloud.spanner.SessionPool$AutoClosingReadContext$1.internalNext(SessionPool.java:151)
	at com.google.cloud.spanner.SessionPool$AutoClosingReadContext$1.next(SessionPool.java:141)

How to get appropriate data type value from mutation in Google Spanner?

In the code below I can get the appropriate data type value.

Map<String, Value> mutationMap = mutation.asMap();
Value locationValue = mutationMap.getOrDefault("location", null);
Long location = locationValue .getInt64();

How to get it within a loop?

new Gson().toJson(mutation.asMap().entrySet().stream().collect(Collectors.toMap(Entry::getKey,e->e.getValue().toString())));

In the above I'm converting everything to string. If the value has data type INT64, how do I get that?

Spanner: Provide a way to get the gRPC status code from a SpannerException

Is your feature request related to a problem? Please describe.

I wanted to convert exceptions thrown by google-cloud-spanner to instances of io.grpc.Status. For example, I wanted to set the status on OpenCensus tracing spans, and OpenCensus provides a utility that takes a gRPC Status.

I wasn't able to find an easy way to get the io.grpc.Status.Code from a SpannerException. However, I noticed that SpannerException has a getErrorCode() method that returns a com.google.cloud.spanner.ErrorCode, and ErrorCode has a field of type io.grpc.Status.Code:
https://github.com/googleapis/google-cloud-java/blob/b6a364a101560f0eb7499176649b53f3cab08854/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/ErrorCode.java#L58

Describe the solution you'd like

I'm not sure what is the best solution. I assume that SpannerException.getErrorCode() doesn't return a io.grpc.Status.Code because io.grpc.Status.Code includes OK and an exception is always an error. One solution is to make the existing ErrorCode.getGrpcStatus()
method public.

Describe alternatives you've considered
I am currently working around this issue by parsing the enum name, though it is fragile:

Status.Code.valueOf(((SpannerException) e).getErrorCode().toString())

Additional context
Add any other context or screenshots about the feature request here.

Synthesis failed for java-spanner

Hello! Autosynth couldn't regenerate java-spanner. ๐Ÿ’”

Here's the output from running synth.py:

Cloning into 'working_repo'...
Switched to a new branch 'autosynth'
Cloning into '/tmpfs/tmp/tmpc3v3laol/googleapis'...
Cloning into '/tmpfs/tmp/tmpc3v3laol/synthtool'...
Switched to branch 'autosynth-self'
Note: checking out '90413f7e0240c50a37282f5fdc6a1370e48f8c11'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 90413f7 tests: Attempt to fix random timeouts in ITBackup (#184)
Note: checking out 'ee4ea76504aa60c2bff9b7c11269c155d8c21e0d'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at ee4ea765 gapic-generator: - feat: Support extra plugin_args for php bazel rules rules (#3165) - feat: support '*' in resource definition (#3163) - fix: add null check and better error message when referenced resource is not found (#3169)
Note: checking out '52638600f387deb98efb5f9c85fec39e82aa9052'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 5263860 build(java): set GOOGLE_CLOUD_PROJECT env for samples/integration tests (#484)
Switched to a new branch 'autosynth-self-2'
2020-04-30 14:01:34 [INFO] Running synthtool
2020-04-30 14:01:34 [INFO] ['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/tmpfs/src/github/synthtool/synthtool/__init__.py", line 21, in <module>
    from synthtool import update_check
  File "/tmpfs/src/github/synthtool/synthtool/update_check.py", line 19, in <module>
    import packaging.version
ModuleNotFoundError: No module named 'packaging'
2020-04-30 14:01:34 [ERROR] Synthesis failed
HEAD is now at 90413f7 tests: Attempt to fix random timeouts in ITBackup (#184)
Switched to branch 'autosynth-self'
Note: checking out '90413f7e0240c50a37282f5fdc6a1370e48f8c11'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 90413f7 tests: Attempt to fix random timeouts in ITBackup (#184)
Previous HEAD position was ee4ea765 gapic-generator: - feat: Support extra plugin_args for php bazel rules rules (#3165) - feat: support '*' in resource definition (#3163) - fix: add null check and better error message when referenced resource is not found (#3169)
HEAD is now at 7e1c7603 Add an OAuth scope annotation in build_service proto file
Previous HEAD position was 5263860 build(java): set GOOGLE_CLOUD_PROJECT env for samples/integration tests (#484)
HEAD is now at 6b685a2 fix: synthtool path (#515)
Switched to a new branch 'autosynth-88'
2020-04-30 14:01:34 [INFO] Running synthtool
2020-04-30 14:01:34 [INFO] ['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/tmpfs/src/github/synthtool/synthtool/__init__.py", line 21, in <module>
    from synthtool import update_check
  File "/tmpfs/src/github/synthtool/synthtool/update_check.py", line 19, in <module>
    import packaging.version
ModuleNotFoundError: No module named 'packaging'
2020-04-30 14:01:34 [ERROR] Synthesis failed
HEAD is now at 90413f7 tests: Attempt to fix random timeouts in ITBackup (#184)
Switched to branch 'autosynth'
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 576, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 457, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 566, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 352, in synthesize_loop
    synthesize_inner_loop(toolbox, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 362, in synthesize_inner_loop
    synthesizer, len(toolbox.versions) - 1
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 259, in synthesize_version_in_new_branch
    synthesizer.synthesize(self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 115, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

Synthesis failed for java-spanner

Hello! Autosynth couldn't regenerate java-spanner. ๐Ÿ’”

Here's the output from running synth.py:

Cloning into 'working_repo'...
Switched to branch 'autosynth'
Running synthtool
['/tmpfs/src/git/autosynth/env/bin/python3', '-m', 'synthtool', 'synth.py', '--']
synthtool > Executing /tmpfs/src/git/autosynth/working_repo/synth.py.
On branch autosynth
nothing to commit, working tree clean
HEAD detached at FETCH_HEAD
nothing to commit, working tree clean
synthtool > Ensuring dependencies.
synthtool > Pulling artman image.
latest: Pulling from googleapis/artman
Digest: sha256:6aec9c34db0e4be221cdaf6faba27bdc07cfea846808b3d3b964dfce3a9a0f9b
Status: Image is up to date for googleapis/artman:latest
synthtool > Cloning googleapis.
synthtool > Running generator for google/spanner/artman_spanner.yaml.
synthtool > Generated code into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/StructTypeOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeySetOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BatchCreateSessionsResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionSelector.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeyRange.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ListSessionsResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Session.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/DeleteSessionRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ReadRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MutationOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionQueryRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/GetSessionRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetMetadata.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BatchCreateSessionsRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionQueryRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PlanNode.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/QueryPlanProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptionsOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RollbackRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/QueryPlanOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PlanNodeOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeyRangeOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetMetadataOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteSqlRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ReadRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Transaction.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Mutation.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/DeleteSessionRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SessionOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionResponseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetStats.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeCode.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionReadRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetStatsOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/QueryPlan.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ListSessionsRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TypeOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionOptions.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/GetSessionRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MutationProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CreateSessionRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/RollbackRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionOptionsOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/StructType.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BatchCreateSessionsRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BatchCreateSessionsResponseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionSelectorOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeysProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Type.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteSqlRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ListSessionsRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/Partition.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartitionReadRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/KeySet.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CreateSessionRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ListSessionsResponseOrBuilder.java.
synthtool > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/DatabaseName.java.
synthtool > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SessionName.java.
synthtool > Replaced 'package com.google.spanner.v1;' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/grpc-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerGrpc.java.
synthtool > Running generator for google/spanner/admin/database/artman_spanner_admin_database.yaml.
synthtool > Generated code into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListDatabasesResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/SpannerDatabaseAdminProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetDatabaseDdlRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetDatabaseRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListDatabasesRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetDatabaseDdlResponseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/UpdateDatabaseDdlRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/UpdateDatabaseDdlMetadataOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseMetadata.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/UpdateDatabaseDdlMetadata.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListDatabasesRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseMetadataOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetDatabaseRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetDatabaseDdlResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/Database.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DropDatabaseRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/UpdateDatabaseDdlRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/GetDatabaseDdlRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/CreateDatabaseRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DropDatabaseRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/ListDatabasesResponseOrBuilder.java.
synthtool > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseName.java.
synthtool > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/InstanceName.java.
synthtool > Replaced 'package com.google.spanner.admin.database.v1;' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/grpc-google-cloud-spanner-admin-database-v1/src/main/java/com/google/spanner/admin/database/v1/DatabaseAdminGrpc.java.
synthtool > Running generator for google/spanner/admin/instance/artman_spanner_admin_instance.yaml.
synthtool > Generated code into /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstanceRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstanceRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstanceConfigRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstanceConfigsResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstanceMetadataOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/SpannerInstanceAdminProto.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstanceConfigsRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstanceRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceConfig.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceConfigOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstanceMetadataOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstanceRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstanceRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaInfoOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstanceMetadata.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesResponse.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstanceRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstancesRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/CreateInstanceRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstanceConfigsResponseOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/DeleteInstanceRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ListInstanceConfigsRequest.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/Instance.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/UpdateInstanceMetadata.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/GetInstanceConfigRequestOrBuilder.java.
synthtool > Replaced '// Generated by the protocol buffer compiler.  DO NOT EDIT!' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ReplicaInfo.java.
synthtool > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceConfigName.java.
synthtool > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceName.java.
synthtool > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/proto-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/ProjectName.java.
synthtool > Replaced 'package com.google.spanner.admin.instance.v1;' in /home/kbuilder/.cache/synthtool/googleapis/artman-genfiles/java/grpc-google-cloud-spanner-admin-instance-v1/src/main/java/com/google/spanner/admin/instance/v1/InstanceAdminGrpc.java.
synthtool > Running java formatter on 195 files
synthtool > Running java formatter on 1 files
synthtool > Running java formatter on 80 files
synthtool > Running java formatter on 1 files
synthtool > Running java formatter on 25 files
synthtool > Running java formatter on 1 files
synthtool > Running java formatter on 32 files
synthtool > Wrote metadata to synth.metadata.
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/tmpfs/src/git/autosynth/working_repo/synth.py", line 68, in <module>
    templates = common_templates.java_library()
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/gcp/common.py", line 75, in java_library
    return self._generic_library("java_library", **kwargs)
  File "/tmpfs/src/git/autosynth/env/lib/python3.6/site-packages/synthtool/gcp/common.py", line 43, in _generic_library
    if not kwargs["metadata"]["samples"]:
KeyError: 'samples'

Synthesis failed

Google internal developers can see the full log here.

ListDatabaseOperations should filter on metadata type first, and then metadata field

ListDatabaseOperations requests must specify filter options in a specific order:

  • This will fail: (metadata.source_type=BACKUP) (metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata)
  • This will succeed: (metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) (metadata.source_type=BACKUP)

The client library currently creates filters that can contain these fields in the opposite order, which causes RPC's to fail.

spanner: Client library sending a high rate of BeginTransaction requests when database is deleted

Once a database is deleted and if the Java Spanner client is still left open, it starts sending a large number of BeginTransaction requests. The additional requests fail with status NOT_FOUND.

The following error just keeps repeating in the logs:

Nov 07, 2019 10:20:16 PM com.google.cloud.spanner.spi.v1.LoggingInterceptor$CallLogger log FINER: google.spanner.v1.Spanner/BeginTransaction[74f0a03d]: Start
Nov 07, 2019 10:20:16 PM com.google.cloud.spanner.spi.v1.LoggingInterceptor$CallLogger log FINER: google.spanner.v1.Spanner/BeginTransaction[74f0a03d]: Send: session: "projects/<project>/instances/<instance>/databases/<database>/sessions/<session>" options { read_write { } }
Nov 07, 2019 10:20:16 PM com.google.cloud.spanner.spi.v1.LoggingInterceptor$CallLogger log FINER: google.spanner.v1.Spanner/BeginTransaction[74f0a03d]: Closed with status Status{code=NOT_FOUND, description=Database not found: projects/<project>/instances/<instance>/databases/<database> resource_type: "type.googleapis.com/google.spanner.admin.database.v1.Database" resource_name: "projects/<project>/instances/<instance>/databases/<database>" description: "Database does not exist." , cause=null} and trailers Metadata(...)

I'm guessing this is happening in an attempt to replenish the pool.

Instrument Spanner client (session pool) with OpenCensus metrics

Is your feature request related to a problem? Please describe.
Customers run into the Cloud Spanner session pool tuning issues for their specific workload on a regular basis. Improved visibility into the state of the session pool (or client side metrics) maintained by each client can provide actionable insight and help users take informed decisions.

This will also help customers in identifying a session leaks.

Describe the solution you'd like
Instrument Spanner client (session pool) with OpenCensus metrics. we need to capture things including - number of max sessions, number of sessions in use, leaked sessions, count of active spanner requests, count of released and acquired sessions.

Describe alternatives you've considered
N/A

Additional context
N/A

===================================================================
Edit1: Agreed list of useful metrics:

All the metrics will be prefixed by โ€œcloud.google.com/java/spanner/โ€.

Metric Description Type Labels
max_in_use_sessions The maximum number of sessions in use during the last 10 minute interval Gauge database, instance_id, library_version
max_allowed_sessions The maximum number of sessions allowed. Configurable by the user Gauge database, instance_id, library_version
in_use_sessions The number of sessions currently in use Gauge database, instance_id, library_version
get_session_timeouts The number of get sessions timeouts due to pool exhaustion Counter database, instance_id, library_version
num_acquired_sessions The number of sessions acquired from the session pool Counter database, instance_id, library_version
num_released_sessions The number of sessions released by the user and pool maintainer Counter database, instance_id, library_version
num_sessions_in_pool The number of sessions in the pool. Gauge database, instance_id, library_version, Type
  • Type : num_in_use_sessions | num_sessions_being_prepared | num_read_sessions | num_write_prepared_sessions

/cc @skuruppu

Integration tests do not clean up instances under an exception

Environment details

spanner/v1.49.2

Steps to reproduce

When the following code has a timeout exception, the created instance will not be cleaned up.

createdInstance = op.get(30000L, TimeUnit.MILLISECONDS);

I get the following exception:

Caused by: java.util.concurrent.TimeoutException: Waited 30000 milliseconds (plus 129893 nanoseconds delay) for com.google.common.util.concurrent.AbstractCatchingFuture$CatchingFuture@26b95b0b[status=PENDING, info=[inputFuture=[com.google.api.core.ApiFutureToListenableFuture@5f7da3d3], exceptionType=[class java.lang.Exception], fallback=[com.google.api.core.ApiFutures$GaxFunctionToGuavaFunction@103082dd]]]
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:509)
        at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:102)
        at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:68)
        at com.google.api.gax.longrunning.OperationFutureImpl.get(OperationFutureImpl.java:133)
        at com.google.cloud.spanner.IntegrationTestEnv.initializeInstance(IntegrationTestEnv.java:124)
        ... 21 more

But the instance is created successfully but is not deleted. Then, all subsequent tests fail with "Instance already exists" error:

com.google.cloud.spanner.SpannerException: ALREADY_EXISTS: com.google.cloud.spanner.SpannerException: ALREADY_EXISTS: io.grpc.StatusRuntimeException: ALREADY_EXISTS: Instance already exists: projects/test-project/instances/test-instance

Expected behaviour

If a test fails with an exception but an instance is created, the instance should be deleted properly and it should not affect the subsequent tests.

Synthesis failed for java-spanner

Hello! Autosynth couldn't regenerate java-spanner. ๐Ÿ’”

Here's the output from running synth.py:

Cloning into 'working_repo'...
Switched to branch 'autosynth'
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/git/autosynth/autosynth/synth.py", line 256, in <module>
    main()
  File "/tmpfs/src/git/autosynth/autosynth/synth.py", line 196, in main
    last_synth_commit_hash = get_last_metadata_commit(args.metadata_path)
  File "/tmpfs/src/git/autosynth/autosynth/synth.py", line 149, in get_last_metadata_commit
    text=True,
  File "/home/kbuilder/.pyenv/versions/3.6.1/lib/python3.6/subprocess.py", line 403, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'text'

Google internal developers can see the full log here.

test: DatabaseAdminClientTest.restoreTestBackup is flaky

DatabaseAdminClientTest.restoreTestBackup sometimes fails on Java8/Windows with the following error:

com.google.cloud.spanner.SpannerException: ALREADY_EXISTS: com.google.cloud.spanner.SpannerException: ALREADY_EXISTS: io.grpc.StatusRuntimeException: ALREADY_EXISTS
	at com.google.cloud.spanner.DatabaseAdminClientTest.restoreTestBackup(DatabaseAdminClientTest.java:820)
	at com.google.cloud.spanner.DatabaseAdminClientTest.setUp(DatabaseAdminClientTest.java:247)
Caused by: java.util.concurrent.ExecutionException: com.google.cloud.spanner.SpannerException: ALREADY_EXISTS: io.grpc.StatusRuntimeException: ALREADY_EXISTS
	at com.google.cloud.spanner.DatabaseAdminClientTest.restoreTestBackup(DatabaseAdminClientTest.java:818)
	at com.google.cloud.spanner.DatabaseAdminClientTest.setUp(DatabaseAdminClientTest.java:247)
Caused by: com.google.cloud.spanner.SpannerException: ALREADY_EXISTS: io.grpc.StatusRuntimeException: ALREADY_EXISTS
	at com.google.cloud.spanner.DatabaseAdminClientTest.restoreTestBackup(DatabaseAdminClientTest.java:817)
	at com.google.cloud.spanner.DatabaseAdminClientTest.setUp(DatabaseAdminClientTest.java:247)
Caused by: io.grpc.StatusRuntimeException: ALREADY_EXISTS

Switch to GitHub actions for unit tests

It looks like the Spanner units need a few environment variables set which we are not providing currently (GOOGLE_CLOUD_PROJECT and maybe others?) See #218

We can look into globally adding some environment variables for the unit tests, or look into mechanisms for selectively added environment variables.

Note: integration & sample tests are unaffected

Experienced '504 Deadline Exceeded' error when tried to delete large number rows by partitioned dml

There are 1 billion old records need to be cleaned. According the documents, It seems Partitioned DML should be the good choice. I choose java client because we can set timeout by using setPartitionedDmlTimeout(Duration.ofHours(24L)). However, I still experienced the '504 Deadline Exceeded' after a few hours that shorter than 24 hours I set. Why setPartitionedDmlTimeout did not work? How should I solve the problem? Is it not possible to delete so large number of data by using Partitioned DML.

Following are the details.

Environment details

  1. Spanner
    3 nodes, 2 billion records in a table and 1 billion old records need to be cleaned
  2. OS type and version: MacOs version 10.15.3
  3. Java version: java 8
  4. spanner version(s): the latest version

Steps to reproduce

  1. Write 2 billion records with timestamp in to the spanner table with dataflow
  2. Run a clean job to delete the old 1 billion records with Partitioned DML by java client
  3. Set the timeout to be 24 hours by using setPartitionedDmlTimeout(Duration.ofHours(24L))
  4. Run the java code

Code example

SpannerOptions options = SpannerOptions.newBuilder().setPartitionedDmlTimeout(Duration.ofHours(24L)).build();

        Spanner spanner = options.getService();
        try {

            DatabaseId db = DatabaseId.of(options.getProjectId(), args[0], args[1]);
            // [END init_client]
            //This will return the default project id based on the environment.
            String clientProject = spanner.getOptions().getProjectId();
            if (!db.getInstanceId().getProject().equals(clientProject)) {
                System.err.println(
                        "Invalid project specified. Project in the database id should match the"
                                + "project name set in the environment variable GOOGLE_CLOUD_PROJECT. Expected: "
                                + clientProject);
            }

            // [START init_client]
            DatabaseClient dbClient = spanner.getDatabaseClient(db);

            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss.SSS");
            String sql="DELETE FROM MyTable WHERE updateTimestamp<'2020-05-02T03:00:00Z'";
            Date currentDate = new Date();
            System.out.println(String.format("Delete Start:%s",formatter.format(currentDate)));

            long lStartTime = Instant.now().toEpochMilli();
            deleteUsingPartitionedDml(dbClient,sql);
            long lEndTime = Instant.now().toEpochMilli();
            long elaspedTime = lEndTime - lStartTime;
            System.out.println("Elapsed time in : " + elaspedTime/1000);

        } finally {
            spanner.close();
        }
        // [END init_client]
        System.out.println("Closed client");
    }
    private static void deleteUsingPartitionedDml(DatabaseClient dbClient,String sql) {
        long rowCount = dbClient.executePartitionedUpdate(Statement.of(sql));

        System.out.printf("%d records deleted.\n", rowCount);
    }

warning:none() in org.junit.rules.ExpectedException has been deprecated.

[INFO] Compiling 162 source files to F:\google-cloud-repository\java-spanner\google-cloud-spanner\target\test-classes
[WARNING] bootstrap class path not set in conjunction with -source 1.7
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITReadWriteAutocommitSpannerTest.java:
[50,63] none() in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITDatabaseTest.java:[51,71] none() in org.junit.r
ules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java:[52,71] none() in org.junit.r
ules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/AbstractConnectionImplTest.java:[66,63] n
one() in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MutationTest.java:[42,71] none() in org.junit.rules.
ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionImplTest.java:[69,71] none() in org.junit.rul
es.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ValueTest.java:[46,71] none() in org.junit.rules.Exp
ectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryOptionsTest.java:[48,71] none() in org.jun
it.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResumableStreamIteratorTest.java:[115,71] none() in
org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TimestampBoundTest.java:[40,71] none() in org.junit.
rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementTimeoutTest.java:[103,62] none()
 in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITClosedSessionTest.java:[59,71] none() in org.ju
nit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpanTest.java:[122,71] none() in org.junit.rules.Exp
ectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITWriteTest.java:[99,71] none() in org.junit.rule
s.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java:[30,71] none() in org.junit.rules.E
xpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DmlBatchTest.java:[47,63] none() in org.j
unit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpannerOptionsTest.java:[49,60] none() in org.junit.
rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITTransactionManagerTest.java:[50,71] none() in o
rg.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TypeTest.java:[34,71] none() in org.junit.rules.Expe
ctedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/PartitionOptionsTest.java:[32,71] none() in org.juni
t.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/OperationTest.java:[52,71] none() in org.junit.rules
.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITReadTest.java:[79,71] none() in org.junit.rules
.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/BackupIdTest.java:[31,71] none() in org.junit.rules.
ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceIdTest.java:[30,71] none() in org.junit.rule
s.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITDatabaseAdminTest.java:[77,71] none() in org.ju
nit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceAdminGaxTest.java:[199,71] none() in org.jun
it.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITQueryTest.java:[62,71] none() in org.junit.rule
s.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseAdminGaxTest.java:[193,71] none() in org.jun
it.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/AbstractStructReaderTypesTest.java:[277,71] none() i
n org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/BackupTest.java:[49,71] none() in org.junit.rules.Ex
pectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/DdlBatchTest.java:[68,63] none() in org.j
unit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/InstanceConfigIdTest.java:[30,71] none() in org.juni
t.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/StatementResultImplTest.java:[38,63] none
() in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITInstanceAdminTest.java:[48,71] none() in org.ju
nit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java:[93,71] none() in org.junit.rul
es.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITReadOnlyTxnTest.java:[65,71] none() in org.juni
t.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/TransactionManagerImplTest.java:[72,63] none() in or
g.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseIdTest.java:[30,71] none() in org.junit.rule
s.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITReadOnlySpannerTest.java:[58,63] non
e() in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolOptionsTest.java:[34,71] none() in org.ju
nit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsTest.java:[40,62] none() in org.junit.rule
s.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseTest.java:[47,71] none() in org.junit.rules.
ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SpannerGaxRetryTest.java:[104,71] none() in org.juni
t.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/KeyRangeTest.java:[34,71] none() in org.junit.rules.
ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/it/ITBackupTest.java:[85,71] none() in org.junit.rul
es.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadWriteTransactionTest.java:[63,69] non
e() in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolIntegrationTest.java:[51,71] none() in or
g.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MockDatabaseAdminServiceImplTest.java:[82,63] none()
 in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/StatementTest.java:[34,71] none() in org.junit.rules
.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/StructTest.java:[36,71] none() in org.junit.rules.Ex
pectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITTransactionModeTest.java:[43,63] non
e() in org.junit.rules.ExpectedException has been deprecated
[WARNING] /F:/google-cloud-repository/java-spanner/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ReadOnlyTransactionTest.java:[57,63] none
() in org.junit.rules.ExpectedException has been deprecated

Recognize and handle 'Instance not found'

The client library recognizes DatabaseNotFound errors and handles these by halting any further RPCs for the database, as the RPCs would fail. This should also be done for InstanceNotFound.

Spanner emulator for local testing

Our team is using Cloud Spanner throughout our infrastructure. We are currently testing our code using a remote Spanner instance but are interested in an emulator that can be run locally so as to cut down on test time and allow our testing to scale. Is there any plan to support a local Spanner emulator? Thanks!

Synthesis failed for java-spanner

Hello! Autosynth couldn't regenerate java-spanner. ๐Ÿ’”

Here's the output from running synth.py:

r implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /tmpfs/tmp/tmp4pebi2fi/google-cloud-admin-instance-v1-java/proto-google-cloud-admin-instance-v1-java/src/main/java/com/google/spanner/admin/instance/v1/InstanceName.java.
2020-05-14 17:04:58,989 synthtool [INFO] > Replaced '/\\*\n \\* Copyright \\d{4} Google LLC\n \\*\n \\* Licensed under the Apache License, Version 2.0 \\(the "License"\\); you may not use this file except\n \\* in compliance with the License. You may obtain a copy of the License at\n \\*\n \\* http://www.apache.org/licenses/LICENSE-2.0\n \\*\n \\* Unless required by applicable law or agreed to in writing, software distributed under the License\n \\* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n \\* or implied. See the License for the specific language governing permissions and limitations under\n \\* the License.\n \\*/\n' in /tmpfs/tmp/tmp4pebi2fi/google-cloud-admin-instance-v1-java/proto-google-cloud-admin-instance-v1-java/src/main/java/com/google/spanner/admin/instance/v1/ProjectName.java.
2020-05-14 17:04:58,991 synthtool [INFO] > Replaced '^package (.*);' in /tmpfs/tmp/tmp4pebi2fi/google-cloud-admin-instance-v1-java/grpc-google-cloud-admin-instance-v1-java/src/main/java/com/google/spanner/admin/instance/v1/InstanceAdminGrpc.java.
2020-05-14 17:04:59,011 synthtool [INFO] > Running java formatter on 310 files
2020-05-14 17:05:13,163 synthtool [INFO] > Running java formatter on 1 files
2020-05-14 17:05:16,036 synthtool [INFO] > Running java formatter on 80 files
2020-05-14 17:05:27,376 synthtool [INFO] > Running java formatter on 1 files
2020-05-14 17:05:30,345 synthtool [INFO] > Running java formatter on 65 files
2020-05-14 17:05:38,436 synthtool [INFO] > Running java formatter on 1 files
2020-05-14 17:05:41,072 synthtool [INFO] > Running java formatter on 32 files
2020-05-14 17:05:46,678 synthtool [DEBUG] > Using precloned repo /home/kbuilder/.cache/synthtool/synthtool
.github/ISSUE_TEMPLATE/bug_report.md
.github/ISSUE_TEMPLATE/feature_request.md
.github/ISSUE_TEMPLATE/support_request.md
.github/PULL_REQUEST_TEMPLATE.md
.github/release-please.yml
.github/trusted-contribution.yml
.github/workflows/ci.yaml
.kokoro/build.bat
.kokoro/build.sh
.kokoro/coerce_logs.sh
.kokoro/common.cfg
.kokoro/common.sh
.kokoro/continuous/common.cfg
.kokoro/continuous/dependencies.cfg
.kokoro/continuous/integration.cfg
.kokoro/continuous/java11.cfg
.kokoro/continuous/java7.cfg
.kokoro/continuous/java8-osx.cfg
.kokoro/continuous/java8-win.cfg
.kokoro/continuous/java8.cfg
.kokoro/continuous/lint.cfg
.kokoro/continuous/propose_release.cfg
.kokoro/continuous/samples.cfg
.kokoro/dependencies.sh
.kokoro/linkage-monitor.sh
.kokoro/nightly/common.cfg
.kokoro/nightly/dependencies.cfg
.kokoro/nightly/integration.cfg
.kokoro/nightly/java11.cfg
.kokoro/nightly/java7.cfg
.kokoro/nightly/java8-osx.cfg
.kokoro/nightly/java8-win.cfg
.kokoro/nightly/java8.cfg
.kokoro/nightly/lint.cfg
.kokoro/nightly/samples.cfg
.kokoro/presubmit/clirr.cfg
.kokoro/presubmit/common.cfg
.kokoro/presubmit/dependencies.cfg
.kokoro/presubmit/integration.cfg
.kokoro/presubmit/java11.cfg
.kokoro/presubmit/java7.cfg
.kokoro/presubmit/java8-osx.cfg
.kokoro/presubmit/java8-win.cfg
.kokoro/presubmit/java8.cfg
.kokoro/presubmit/linkage-monitor.cfg
.kokoro/presubmit/lint.cfg
.kokoro/presubmit/samples.cfg
.kokoro/release/bump_snapshot.cfg
.kokoro/release/common.cfg
.kokoro/release/common.sh
.kokoro/release/drop.cfg
.kokoro/release/drop.sh
.kokoro/release/promote.cfg
.kokoro/release/promote.sh
.kokoro/release/publish_javadoc.cfg
.kokoro/release/publish_javadoc.sh
.kokoro/release/snapshot.cfg
.kokoro/release/snapshot.sh
.kokoro/release/stage.cfg
.kokoro/release/stage.sh
.kokoro/trampoline.sh
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
codecov.yaml
java.header
license-checks.xml
renovate.json
samples/install-without-bom/pom.xml
samples/pom.xml
samples/snapshot/pom.xml
samples/snippets/pom.xml
2020-05-14 17:05:46,854 synthtool [DEBUG] > existing pom file found (samples/pom.xml) - keeping the existing
2020-05-14 17:05:46,855 synthtool [DEBUG] > existing pom file found (samples/snippets/pom.xml) - keeping the existing
2020-05-14 17:05:46,856 synthtool [DEBUG] > existing pom file found (samples/install-without-bom/pom.xml) - keeping the existing
2020-05-14 17:05:46,857 synthtool [DEBUG] > existing pom file found (samples/snapshot/pom.xml) - keeping the existing
2020-05-14 17:05:46,896 synthtool [DEBUG] > Wrote metadata to synth.metadata.
2020-05-14 17:05:46,977 autosynth [INFO] > Changed files:
2020-05-14 17:05:46,977 autosynth [INFO] > M .kokoro/build.bat
 M CONTRIBUTING.md
 M README.md
 M synth.metadata
?? .github/workflows/
2020-05-14 17:05:46,977 autosynth [DEBUG] > Running: git log 5b48b0716a36ca069db3038da7e205c87a22ed19 -1 --no-decorate --pretty=%B%n%nSource-Author: %an <%ae>%nSource-Date: %ad
2020-05-14 17:05:46,982 autosynth [DEBUG] > Running: git add -A
2020-05-14 17:05:46,991 autosynth [DEBUG] > Running: git commit -m docs: update CONTRIBUTING.md to include code formatting (#534)

Co-authored-by: Jeff Ching <[email protected]>
Co-authored-by: Jeffrey Rennie <[email protected]>

Source-Author: Brian Chen <[email protected]>
Source-Date: Tue May 12 10:24:59 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 5b48b0716a36ca069db3038da7e205c87a22ed19
Source-Link: https://github.com/googleapis/synthtool/commit/5b48b0716a36ca069db3038da7e205c87a22ed19
[autosynth-82 64bb317] docs: update CONTRIBUTING.md to include code formatting (#534)
 5 files changed, 93 insertions(+), 8 deletions(-)
 create mode 100644 .github/workflows/ci.yaml
2020-05-14 17:05:47,002 autosynth [DEBUG] > Running: git reset --hard HEAD
HEAD is now at 64bb317 docs: update CONTRIBUTING.md to include code formatting (#534)
2020-05-14 17:05:47,011 autosynth [DEBUG] > Running: git checkout autosynth
Switched to branch 'autosynth'
2020-05-14 17:05:47,019 autosynth [DEBUG] > Running: git diff HEAD..autosynth-82 -- . :(exclude)synth.metadata
2020-05-14 17:05:47,023 autosynth [DEBUG] > Running: git diff HEAD autosynth-82
2020-05-14 17:05:47,027 autosynth [DEBUG] > Running: git apply /tmpfs/tmp/tmpn2yr54qp/autosynth-82.patch
2020-05-14 17:05:47,031 autosynth [DEBUG] > Running: git add -A
2020-05-14 17:05:47,039 autosynth [DEBUG] > Running: git commit -m docs: update CONTRIBUTING.md to include code formatting (#534)

Co-authored-by: Jeff Ching <[email protected]>
Co-authored-by: Jeffrey Rennie <[email protected]>

Source-Author: Brian Chen <[email protected]>
Source-Date: Tue May 12 10:24:59 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 5b48b0716a36ca069db3038da7e205c87a22ed19
Source-Link: https://github.com/googleapis/synthtool/commit/5b48b0716a36ca069db3038da7e205c87a22ed19
[autosynth aa23ee8] docs: update CONTRIBUTING.md to include code formatting (#534)
 2 files changed, 13 insertions(+), 4 deletions(-)
2020-05-14 17:05:47,048 autosynth [DEBUG] > Running: git diff autosynth-82..autosynth-84 -- . :(exclude)synth.metadata
2020-05-14 17:05:47,052 autosynth [DEBUG] > Running: git diff autosynth-82..autosynth-84 -- synth.metadata
2020-05-14 17:05:47,056 autosynth [DEBUG] > Running: git diff autosynth-84..autosynth-87 -- . :(exclude)synth.metadata
2020-05-14 17:05:47,059 autosynth [DEBUG] > Running: git diff autosynth-84..autosynth-87 -- synth.metadata
2020-05-14 17:05:47,063 autosynth [DEBUG] > Running: git diff autosynth-87..autosynth-100 -- . :(exclude)synth.metadata
2020-05-14 17:05:47,066 autosynth [DEBUG] > Running: git diff autosynth-87..autosynth-100 -- synth.metadata
2020-05-14 17:05:47,070 autosynth [DEBUG] > Running: git push --force origin autosynth
To https://github.com/googleapis/java-spanner.git
 + 793c822...aa23ee8 autosynth -> autosynth (forced update)
2020-05-14 17:05:50,714 autosynth [DEBUG] > Running: git log -4 --pretty=%b
2020-05-14 17:05:51,121 autosynth [ERROR] > Error making request (422): Validation Failed
2020-05-14 17:05:51,121 autosynth [DEBUG] > {'message': 'Validation Failed', 'errors': [{'resource': 'PullRequest', 'code': 'custom', 'message': 'A pull request already exists for googleapis:autosynth.'}], 'documentation_url': 'https://developer.github.com/v3/pulls/#create-a-pull-request'}
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 600, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 472, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 590, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 368, in synthesize_loop
    toolbox.push_changes(change_pusher)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 292, in push_changes
    pr = change_pusher.push_changes(self.commit_count, self.branch, pr_title)
  File "/tmpfs/src/github/synthtool/autosynth/change_pusher.py", line 92, in push_changes
    body=build_pr_body(synth_log, trailers),
  File "/tmpfs/src/github/synthtool/autosynth/github.py", line 84, in create_pull_request
    return cast(Dict, _get_json_or_raise_exception(response))
  File "/tmpfs/src/github/synthtool/autosynth/github.py", line 389, in _get_json_or_raise_exception
    response.raise_for_status()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/requests/models.py", line 941, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.github.com/repos/googleapis/java-spanner/pulls

Google internal developers can see the full log here.

test: SessionPoolTest.testSessionMetrics is flaky

value of: map.get(cloud.google.com/java/spanner/get_session_timeouts)
expected: 0
but was : 1
map was : {cloud.google.com/java/spanner/max_in_use_sessions=2, cloud.google.com/java/spanner/in_use_sessions=2, cloud.google.com/java/spanner/get_session_timeouts=1, cloud.google.com/java/spanner/max_allowed_sessions=2, cloud.google.com/java/spanner/num_acquired_sessions=2, cloud.google.com/java/spanner/num_released_sessions=0}
	at com.google.cloud.spanner.SessionPoolTest.testSessionMetrics(SessionPoolTest.java:1692)

Spanner: ITDatabaseAdminTest.listPagination is flaky

https://source.cloud.google.com/results/invocations/4971e32c-c95b-4a44-8274-6d6311f1fed8/targets/github%2Fgoogle-cloud-java%2Fgoogle-cloud-clients%2Fgoogle-cloud-spanner%2Ftarget%2Ffailsafe-reports/tests

com.google.cloud.spanner.SpannerException: INVALID_ARGUMENT: com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: projects/{project ID} is missing from uri.
	at com.google.cloud.spanner.SpannerExceptionFactory.newSpannerExceptionPreformatted(SpannerExceptionFactory.java:182)
	at com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException(SpannerExceptionFactory.java:45)
	at com.google.cloud.spanner.SpannerExceptionFactory.newSpannerException(SpannerExceptionFactory.java:139)
	at com.google.cloud.spanner.spi.v1.GapicSpannerRpc.get(GapicSpannerRpc.java:616)
	at com.google.cloud.spanner.spi.v1.GapicSpannerRpc.listDatabases(GapicSpannerRpc.java:379)
	at com.google.cloud.spanner.DatabaseAdminClientImpl$5.getNextPage(DatabaseAdminClientImpl.java:143)
	at com.google.cloud.spanner.SpannerImpl$PageFetcher.getNextPage(SpannerImpl.java:283)
	at com.google.cloud.PageImpl.getNextPage(PageImpl.java:116)
	at com.google.cloud.spanner.it.ITDatabaseAdminTest.listPagination(ITDatabaseAdminTest.java:172)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:48)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
	at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.util.concurrent.ExecutionException: com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: projects/{project ID} is missing from uri.
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:552)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:533)
	at com.google.cloud.spanner.spi.v1.GapicSpannerRpc.get(GapicSpannerRpc.java:610)
	... 46 more
Caused by: com.google.api.gax.rpc.InvalidArgumentException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: projects/{project ID} is missing from uri.
	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:49)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
	at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
	at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:982)
	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)
	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:957)
	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:748)
	at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:515)
	at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:490)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at com.google.cloud.spanner.spi.v1.SpannerErrorInterceptor$1$1.onClose(SpannerErrorInterceptor.java:100)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:700)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:399)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:510)
	at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:66)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:630)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:518)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:692)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:681)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: projects/{project ID} is missing from uri.
	at io.grpc.Status.asRuntimeException(Status.java:533)
	... 28 more

test: MockDatabaseAdminServiceImplTest.deleteBackup is flaky

MockDatabaseAdminServiceImplTest.deleteBackup is flaky.

java.util.concurrent.CancellationException: Task was cancelled.
	at com.google.cloud.spanner.MockDatabaseAdminServiceImplTest.createTestBackup(MockDatabaseAdminServiceImplTest.java:333)
	at com.google.cloud.spanner.MockDatabaseAdminServiceImplTest.deleteBackup(MockDatabaseAdminServiceImplTest.java:368)

ITCommitTimestampTest.invalidColumnOptionValue check very specific error message

The Spanner team reported that checking for specific error strings are error-prone as the returned string can change without notice.

I think they're specifically referring to this line:

expectedException.expectMessage("Errors parsing Spanner DDL statement");

If this can be fixed, that would be great.

Spanner - Closing session pool is slow for large pools

Calling Spanner#close() can be slow if the underlying session pool contains a large number of sessions. Spanner#close() will close and cleanup all resources that have been used by the instance, and one of these is the session pool. The method will block until all resources have been cleaned up.

The session pool deletes all its sessions when it is closed. This is done asynchronously using a fixed 8-worker thread executor. Each worker thread blocks while waiting for a session to be deleted. This means that closing a session pool with 1,000 sessions will have an execution time of T * 1000 / 8, where T is the total time needed to delete one session.

Session deletion could be further parallelized for large session pools in order to reduce the total execution time of Spanner#close().

spanner: RetryOnInvalidatedSessionTest failure

I received a report that one of the integration tests fail in an internal environment. I think the test is consistently failing.

Environment details

OS type and version: Unknown
Java version: Unknown
spanner version(s): Google Cloud Spanner 1.52.1-SNAPSHOT

Stack trace

[ERROR] Tests run: 102, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 18.574 s <<< FAILURE! - in com.google.cloud.spanner.RetryOnInvalidatedSessionTest
[ERROR] com.google.cloud.spanner.RetryOnInvalidatedSessionTest.singleUseReadRow[fail on invalidated session = false]  Time elapsed: 3.026 s  <<< FAILURE!
java.lang.AssertionError: MinSessions not created
	at com.google.cloud.spanner.RetryOnInvalidatedSessionTest.invalidateSessionPool(RetryOnInvalidatedSessionTest.java:226)
	at com.google.cloud.spanner.RetryOnInvalidatedSessionTest.invalidateSessionPool(RetryOnInvalidatedSessionTest.java:217)
	at com.google.cloud.spanner.RetryOnInvalidatedSessionTest.singleUseReadRow(RetryOnInvalidatedSessionTest.java:297)

@olavloite if you can take a look, that would be great.

How do I apply a `io.grpc.CallCredentials` to `ServiceOptions`?

I have a private class that generates io.grpc.CallCredentials to authorize to Cloud Spanner. Apparently the ServiceOptions.Builder.setCredentials only knows about com.google.auth.Credentials. I know that the Cloud Spanner communication is done over gRPC. Is there a way to apply my CallCredentials?

Synthesis failed for java-spanner

Hello! Autosynth couldn't regenerate java-spanner. ๐Ÿ’”

Here's the output from running synth.py:

Cloning into 'working_repo'...
Switched to a new branch 'autosynth'
Cloning into '/tmpfs/tmp/tmph11tzzgg/googleapis'...
Cloning into '/tmpfs/tmp/tmph11tzzgg/synthtool'...
Switched to branch 'autosynth-self'
Note: checking out '3b258cf3dd55b2a2b367e162b3ad46fe073b1229'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 3b258cf chore: release 1.54.0 (#188)
Note: checking out 'ab5d07c2883026eec395d73ff59a17f4ad0153db'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at ab5d07c2 fix: set resource type for database parameter of Backup
Note: checking out '716f741f2d307b48cbe8a5bc3bc883571212344a'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 716f741 fix(python): adjust regex for fix_pb2_headers (#500)
Switched to a new branch 'autosynth-self-2'
2020-05-05 21:33:51 [INFO] Running synthtool
2020-05-05 21:33:51 [INFO] ['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']
2020-05-05 21:33:51,400 synthtool > Executing /tmpfs/src/github/synthtool/working_repo/synth.py.
On branch autosynth-self-2
nothing to commit, working tree clean
2020-05-05 21:33:51,534 synthtool > Ensuring dependencies.
2020-05-05 21:33:51,545 synthtool > Cloning googleapis.
2020-05-05 21:33:51,546 synthtool > Using precloned repo /tmpfs/tmp/tmph11tzzgg/googleapis
2020-05-05 21:33:51,550 synthtool > Generating code for: //google/spanner/v1:google-cloud-spanner-v1-java.
2020-05-05 21:33:51,662 synthtool > Failed executing bazel build //google/spanner/v1:google-cloud-spanner-v1-java:

Starting local Bazel server and connecting to it...
Server crashed during startup. Now printing /home/kbuilder/.cache/bazel/_bazel_kbuilder/c1cd6967711e37939875549532aa10f4/server/jvm.out
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000715200000, 247463936, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 247463936 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmpfs/tmp/tmph11tzzgg/googleapis/hs_err_pid27772.log

2020-05-05 21:33:51,663 synthtool > Wrote metadata to synth.metadata.
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmpfs/src/github/synthtool/working_repo/synth.py", line 29, in <module>
    bazel_target=f'//google/spanner/v1:google-cloud-spanner-v1-java',
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 63, in java_library
    return self._generate_code(service, version, "java", **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 177, in _generate_code
    shell.run(bazel_run_args)
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', 'build', '//google/spanner/v1:google-cloud-spanner-v1-java']' returned non-zero exit status 37.
2020-05-05 21:33:51 [ERROR] Synthesis failed
HEAD is now at 3b258cf chore: release 1.54.0 (#188)
Switched to branch 'autosynth-self'
Note: checking out '3b258cf3dd55b2a2b367e162b3ad46fe073b1229'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 3b258cf chore: release 1.54.0 (#188)
Previous HEAD position was ab5d07c2 fix: set resource type for database parameter of Backup
HEAD is now at a3a0bf0f BREAKING_CHANGE: Removing TimeSeriesQueryLanguageCondition as an alert condition type. The condition type is unsupported and unused. It was originally added for the Monitoring Query Language Alpha feature. refactor!: Drop support for TimeSeriesQueryLanguageCondition as an alert condition type.
Previous HEAD position was 716f741 fix(python): adjust regex for fix_pb2_headers (#500)
HEAD is now at ab88356 fix: make .kokoro-autosynth executable (#522)
Switched to a new branch 'autosynth-55'
2020-05-05 21:33:51 [INFO] Running synthtool
2020-05-05 21:33:51 [INFO] ['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']
2020-05-05 21:33:51,975 synthtool > Executing /tmpfs/src/github/synthtool/working_repo/synth.py.
On branch autosynth-55
nothing to commit, working tree clean
2020-05-05 21:33:52,109 synthtool > Ensuring dependencies.
2020-05-05 21:33:52,119 synthtool > Cloning googleapis.
2020-05-05 21:33:52,120 synthtool > Using precloned repo /tmpfs/tmp/tmph11tzzgg/googleapis
2020-05-05 21:33:52,125 synthtool > Generating code for: //google/spanner/v1:google-cloud-spanner-v1-java.
2020-05-05 21:33:52,235 synthtool > Failed executing bazel build //google/spanner/v1:google-cloud-spanner-v1-java:

Starting local Bazel server and connecting to it...
Server crashed during startup. Now printing /home/kbuilder/.cache/bazel/_bazel_kbuilder/c1cd6967711e37939875549532aa10f4/server/jvm.out
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000715200000, 247463936, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 247463936 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /tmpfs/tmp/tmph11tzzgg/googleapis/hs_err_pid27807.log

2020-05-05 21:33:52,236 synthtool > Wrote metadata to synth.metadata.
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 102, in <module>
    main()
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/tmpfs/src/github/synthtool/env/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/__main__.py", line 94, in main
    spec.loader.exec_module(synth_module)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/tmpfs/src/github/synthtool/working_repo/synth.py", line 29, in <module>
    bazel_target=f'//google/spanner/v1:google-cloud-spanner-v1-java',
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 63, in java_library
    return self._generate_code(service, version, "java", **kwargs)
  File "/tmpfs/src/github/synthtool/synthtool/gcp/gapic_bazel.py", line 177, in _generate_code
    shell.run(bazel_run_args)
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 39, in run
    raise exc
  File "/tmpfs/src/github/synthtool/synthtool/shell.py", line 33, in run
    encoding="utf-8",
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['bazel', 'build', '//google/spanner/v1:google-cloud-spanner-v1-java']' returned non-zero exit status 37.
2020-05-05 21:33:52 [ERROR] Synthesis failed
HEAD is now at 3b258cf chore: release 1.54.0 (#188)
Switched to branch 'autosynth'
Traceback (most recent call last):
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 584, in <module>
    main()
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 465, in main
    return _inner_main(temp_dir)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 574, in _inner_main
    commit_count = synthesize_loop(x, multiple_prs, change_pusher, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 360, in synthesize_loop
    synthesize_inner_loop(toolbox, synthesizer)
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 370, in synthesize_inner_loop
    synthesizer, len(toolbox.versions) - 1
  File "/tmpfs/src/github/synthtool/autosynth/synth.py", line 259, in synthesize_version_in_new_branch
    synthesizer.synthesize(self.environ)
  File "/tmpfs/src/github/synthtool/autosynth/synthesizer.py", line 115, in synthesize
    synth_proc.check_returncode()  # Raise an exception.
  File "/home/kbuilder/.pyenv/versions/3.6.9/lib/python3.6/subprocess.py", line 389, in check_returncode
    self.stderr)
subprocess.CalledProcessError: Command '['/tmpfs/src/github/synthtool/env/bin/python3', '-m', 'synthtool', '--metadata', 'synth.metadata', 'synth.py', '--']' returned non-zero exit status 1.

Google internal developers can see the full log here.

ITDml test is flaky

All tests in ITDMLTest.java relies on the same INSERT_DML statement. Each test executes the INSERT_DML & DELETE_DML statements, except abortOnceShouldSucceedAfterRetry test. All tests executed after abortOnceShouldSucceedAfterRetry will fail with "Row already exists" error.

Short term fix:

  • add the DELETE_DML into the test too

Correct / Long term fix:

  • refactor the test cases to not rely on the same set of INSERT/DELETE_dml statements. These tests should be independent (dont try to create a database/create a new table for each test, that will make them slow). Let each test run its own unique INSERT DML that does not interfere with another tests execution.

test: SpannerRetryHelperTest is flaky

On Windows/Java8 the following test failure sometimes occurs:

java.lang.AssertionError:

Expected: is <true>
     but: was <false>
	at com.google.cloud.spanner.SpannerRetryHelperTest.testExceptionWithRetryInfo(SpannerRetryHelperTest.java:219)

BeginTransaction shouldn't retry indefinitely on FAILED_PRECONDITION

A team reported that they're seeing BeginTransaction retrying indefinitely on FAILED_PRECONDITION errors.

This is an issue similar to #16. For now, just giving up on the retries for this specific error would do.

But perhaps we can consider not retrying for all non-retryable errors as well in a separate PR?

Release 1.51.0 has dependency version conflicts

Adding a dependency on google-cloud-spanner version 1.51.0 to a project will cause the following build error:

Could not resolve dependencies for project com.google.cloud:spanner-example-runner:jar:0.0.1-SNAPSHOT: Failed to collect dependencies for com.google.cloud:spanner-example-runner:jar:0.0.1-SNAPSHOT: Could not resolve version conflict among [com.google.cloud:google-cloud-spanner:jar:1.51.0 -> io.grpc:grpc-api:jar:1.28.0, com.google.cloud:google-cloud-spanner:jar:1.51.0 -> io.grpc:grpc-auth:jar:1.28.0 -> io.grpc:grpc-api:jar:[1.28.0,1.28.0], com.google.cloud:google-cloud-spanner:jar:1.51.0 -> io.grpc:grpc-protobuf:jar:1.28.0 -> io.grpc:grpc-api:jar:1.28.0, com.google.cloud:google-cloud-spanner:jar:1.51.0 -> io.grpc:grpc-protobuf:jar:1.28.0 -> io.grpc:grpc-protobuf-lite:jar:1.28.0 -> io.grpc:grpc-api:jar:1.28.0, com.google.cloud:google-cloud-spanner:jar:1.51.0 -> io.grpc:grpc-stub:jar:1.28.0 -> io.grpc:grpc-api:jar:1.28.0, com.google.cloud:google-cloud-spanner:jar:1.51.0 -> com.google.cloud:google-cloud-core-grpc:jar:1.93.2 -> io.grpc:grpc-api:jar:1.27.2, com.google.cloud:google-cloud-spanner:jar:1.51.0 -> com.google.cloud:google-cloud-core-grpc:jar:1.93.2 -> io.grpc:grpc-core:jar:1.27.2 -> io.grpc:grpc-api:jar:[1.27.2,1.27.2]]

StatementParser only supports one query hint

Hello! We've found an obscure select query that the statement parser does not support yet.

Observed behavior

The following evaluates to false:

boolean isQuery = StatementParser.INSTANCE.isQuery("@{FORCE_INDEX=index_name} @{JOIN_METHOD=HASH_JOIN} SELECT * FROM tbl");

Expected behavior

Query Statement with multiple hints is recognized as a valid query.

External references such as API reference guides

Spanner queries can have one of each: query, table and join hint preceding SELECT statement.

Any additional information below

We found this when migrating R2DBC driver from a custom statement parser to the connection API one; this test caught the issue.

spanner: ITBackupTest.testBackups seems to be flaky

I've seen it a couple of times now in Kokoro runs. I suspect it's because we're using the same instance for all tests and when we have multiple concurrent Kokoro runs we run into this issue. @olavloite it would be great if you could take a look.

The error is:

java.util.concurrent.ExecutionException: com.google.api.gax.rpc.FailedPreconditionException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: Cannot restore database (projects/gcloud-devel/instances/spanner-testing/databases/testdb_1934564485_0003) because the maximum number of pending restores (1) for the instance (projects/gcloud-devel/instances/spanner-testing) has been reached. Please retry the operation once the pending restores complete.
	at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:553)
	at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:534)
	at com.google.common.util.concurrent.FluentFuture$TrustedFuture.get(FluentFuture.java:86)
	at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:62)
	at com.google.api.gax.longrunning.OperationFutureImpl.getName(OperationFutureImpl.java:138)
	at com.google.cloud.spanner.it.ITBackupTest.testRestore(ITBackupTest.java:484)
	at com.google.cloud.spanner.it.ITBackupTest.testBackups(ITBackupTest.java:303)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:258)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeLazy(JUnitCoreWrapper.java:119)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:87)
	at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
	at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:158)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)
Caused by: com.google.api.gax.rpc.FailedPreconditionException: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: Cannot restore database (projects/gcloud-devel/instances/spanner-testing/databases/testdb_1934564485_0003) because the maximum number of pending restores (1) for the instance (projects/gcloud-devel/instances/spanner-testing) has been reached. Please retry the operation once the pending restores complete.
	at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:59)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72)
	at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60)
	at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97)
	at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68)
	at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1039)
	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
	at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1165)
	at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:958)
	at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:749)
	at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:522)
	at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:497)
	at io.grpc.PartialForwardingClientCallListener.onClose(PartialForwardingClientCallListener.java:39)
	at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:23)
	at io.grpc.ForwardingClientCallListener$SimpleForwardingClientCallListener.onClose(ForwardingClientCallListener.java:40)
	at com.google.cloud.spanner.spi.v1.SpannerErrorInterceptor$1$1.onClose(SpannerErrorInterceptor.java:100)
	at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
	at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:689)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$900(ClientCallImpl.java:577)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:751)
	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:740)
	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: io.grpc.StatusRuntimeException: FAILED_PRECONDITION: Cannot restore database (projects/gcloud-devel/instances/spanner-testing/databases/testdb_1934564485_0003) because the maximum number of pending restores (1) for the instance (projects/gcloud-devel/instances/spanner-testing) has been reached. Please retry the operation once the pending restores complete.
	at io.grpc.Status.asRuntimeException(Status.java:533)
	... 20 more

Session pool metrics registered multiple times

The new metrics that have been added for the SessionPool are added multiple times if multiple different session pools are created by a Spanner instance. This could happen if the user creates database clients for different databases, or if multiple database clients using different SessionPoolOptions are requested. This again will lead to an InvalidArgumentException being thrown. See for example https://source.cloud.google.com/results/invocations/a8dc0694-336f-483b-bb8f-2ee502506a2b/targets/cloud-devrel%2Fjava%2Fjava-docs-samples%2Fjava8%2Fpresubmit/log

Spanner: gRPC Retry and Timeout Settings should be used from configuration

Prepare sessions for r/w tx can be bottleneck

Preparing sessions for read/write transactions can be a bottleneck when a burst of write requests need to be executed. This happens when the executor used to prepare sessions for r/w transactions is overloaded with more requests than it can efficiently handle, and causes a queue to build up.

Instead of only relying on the background executor, the session pool should also allow in-process creation of read/write transactions when the background executor is already full.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.