File tree

27 files changed

+710
-91
lines changed

27 files changed

+710
-91
lines changed
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"git": {
55
"name": ".",
66
"remote": "https://.com/googleapis/java-spanner.git",
7-
"sha": "844f0fe5308797105f2de876290f40fb230c4fa6"
7+
"sha": "fc3335c55eb504827e835b6e5a1d6fc5dea2c124"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "synthtool",
1313
"remote": "https://.com/googleapis/synthtool.git",
14-
"sha": "ff6b759fcb58f216f62b48d5be0bb85fafbc3bb2"
14+
"sha": "06a8cd0ff7e81b05e6c503eab510ec622384caa7"
1515
}
1616
}
1717
]
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,33 @@
11
# Changelog
22

3+
## [6.4.0](https://www..com/googleapis/java-spanner/compare/v6.3.3...v6.4.0) (2021-04-29)
4+
5+
6+
### Features
7+
8+
* adds getValue to ResultSet ([#1073](https://www..com/googleapis/java-spanner/issues/1073)) ([7792c90](https://www..com/googleapis/java-spanner/commit/7792c9085a6e4ce1fb9fe2f8df4279f30539d87e))
9+
10+
11+
### Bug Fixes
12+
13+
* allow using case-insensitive user-agent key ([#1110](https://www..com/googleapis/java-spanner/issues/1110)) ([f4f9e43](https://www..com/googleapis/java-spanner/commit/f4f9e43ce102788b81c032df8da223108e484252))
14+
* check for timeout in connection after last statement finished ([#1086](https://www..com/googleapis/java-spanner/issues/1086)) ([aec0b54](https://www..com/googleapis/java-spanner/commit/aec0b541672d66fe0c34816b1c1b5a6bdeffccd1)), closes [#1077](https://www..com/googleapis/java-spanner/issues/1077)
15+
* check for timeout in connection after last statement finished ([#1086](https://www..com/googleapis/java-spanner/issues/1086)) ([51d753c](https://www..com/googleapis/java-spanner/commit/51d753c507e7248132eb5d6ea2c4b735542eda49)), closes [#1077](https://www..com/googleapis/java-spanner/issues/1077)
16+
* do not keep references to invalidated clients ([#1093](https://www..com/googleapis/java-spanner/issues/1093)) ([b4595a6](https://www..com/googleapis/java-spanner/commit/b4595a6b52417c716f8e70563bb5a7ef05067707)), closes [#1089](https://www..com/googleapis/java-spanner/issues/1089)
17+
* prevent potential NullPointerException in Struct with Array field that contains null elements ([#1107](https://www..com/googleapis/java-spanner/issues/1107)) ([c414abb](https://www..com/googleapis/java-spanner/commit/c414abb9ec59f8200ba20e08846e442321de76bd)), closes [#1106](https://www..com/googleapis/java-spanner/issues/1106)
18+
19+
20+
### Dependencies
21+
22+
* update dependency com.google.cloud:google-cloud-monitoring to v2.2.1 ([#1104](https://www..com/googleapis/java-spanner/issues/1104)) ([37ca990](https://www..com/googleapis/java-spanner/commit/37ca9905bb150d1791e70103e002261e40261b05))
23+
* update dependency com.google.cloud:google-cloud-trace to v1.3.3 ([#1103](https://www..com/googleapis/java-spanner/issues/1103)) ([b4327c0](https://www..com/googleapis/java-spanner/commit/b4327c0666bb97d1d591b5ce65a6ecdc51f5a49d))
24+
25+
26+
### Documentation
27+
28+
* fix javadoc for Date type ([#1102](https://www..com/googleapis/java-spanner/issues/1102)) ([ce095f7](https://www..com/googleapis/java-spanner/commit/ce095f7b0c196e03ea248eeb9c5060f4f430d8c4))
29+
* use default timeout for restore operation ([#1109](https://www..com/googleapis/java-spanner/issues/1109)) ([3f3c13e](https://www..com/googleapis/java-spanner/commit/3f3c13e7fcbf08b8ab6f0d11d7451b3ae86c9500)), closes [#1019](https://www..com/googleapis/java-spanner/issues/1019)
30+
331
### [6.3.3](https://www..com/googleapis/java-spanner/compare/v6.3.2...v6.3.3) (2021-04-24)
432

533

Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file
1717
<dependency>
1818
<groupId>com.google.cloud</groupId>
1919
<artifactId>libraries-bom</artifactId>
20-
<version>20.1.0</version>
20+
<version>20.2.0</version>
2121
<type>pom</type>
2222
<scope>import</scope>
2323
</dependency>
@@ -38,25 +38,25 @@ If you are using Maven without BOM, add this to your dependencies:
3838
<dependency>
3939
<groupId>com.google.cloud</groupId>
4040
<artifactId>google-cloud-spanner</artifactId>
41-
<version>6.2.1</version>
41+
<version>6.4.0</version>
4242
</dependency>
4343

4444
```
4545

4646
If you are using Gradle 5.x or later, add this to your dependencies
4747
```Groovy
48-
implementation platform('com.google.cloud:libraries-bom:20.1.0')
48+
implementation platform('com.google.cloud:libraries-bom:20.2.0')
4949
5050
compile 'com.google.cloud:google-cloud-spanner'
5151
```
5252
If you are using Gradle without BOM, add this to your dependencies
5353
```Groovy
54-
compile 'com.google.cloud:google-cloud-spanner:6.3.0'
54+
compile 'com.google.cloud:google-cloud-spanner:6.4.0'
5555
```
5656

5757
If you are using SBT, add this to your dependencies
5858
```Scala
59-
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.3.0"
59+
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.4.0"
6060
```
6161

6262
## Authentication
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security Policy
2+
3+
To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
4+
5+
The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
6+
7+
We use g.co/vulnz for our intake, and do coordination and disclosure here using Security Advisory to privately discuss and fix the issue.
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-spanner-bom</artifactId>
6-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
6+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
77
<packaging>pom</packaging>
88
<parent>
99
<groupId>com.google.cloud</groupId>
@@ -64,43 +64,43 @@
6464
<dependency>
6565
<groupId>com.google.api.grpc</groupId>
6666
<artifactId>proto-google-cloud-spanner-admin-instance-v1</artifactId>
67-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-instance-v1:current} -->
67+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-instance-v1:current} -->
6868
</dependency>
6969
<dependency>
7070
<groupId>com.google.api.grpc</groupId>
7171
<artifactId>grpc-google-cloud-spanner-v1</artifactId>
72-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-v1:current} -->
72+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-v1:current} -->
7373
</dependency>
7474
<dependency>
7575
<groupId>com.google.api.grpc</groupId>
7676
<artifactId>proto-google-cloud-spanner-v1</artifactId>
77-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-v1:current} -->
77+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-v1:current} -->
7878
</dependency>
7979
<dependency>
8080
<groupId>com.google.api.grpc</groupId>
8181
<artifactId>proto-google-cloud-spanner-admin-database-v1</artifactId>
82-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-database-v1:current} -->
82+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:proto-google-cloud-spanner-admin-database-v1:current} -->
8383
</dependency>
8484
<dependency>
8585
<groupId>com.google.cloud</groupId>
8686
<artifactId>google-cloud-spanner</artifactId>
87-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
87+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
8888
</dependency>
8989
<dependency>
9090
<groupId>com.google.cloud</groupId>
9191
<artifactId>google-cloud-spanner</artifactId>
9292
<type>test-jar</type>
93-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
93+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
9494
</dependency>
9595
<dependency>
9696
<groupId>com.google.api.grpc</groupId>
9797
<artifactId>grpc-google-cloud-spanner-admin-instance-v1</artifactId>
98-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-instance-v1:current} -->
98+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-instance-v1:current} -->
9999
</dependency>
100100
<dependency>
101101
<groupId>com.google.api.grpc</groupId>
102102
<artifactId>grpc-google-cloud-spanner-admin-database-v1</artifactId>
103-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-database-v1:current} -->
103+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:grpc-google-cloud-spanner-admin-database-v1:current} -->
104104
</dependency>
105105
</dependencies>
106106
</dependencyManagement>
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.cloud</groupId>
55
<artifactId>google-cloud-spanner</artifactId>
6-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
6+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
77
<packaging>jar</packaging>
88
<name>Google Cloud Spanner</name>
99
<url>https://.com/googleapis/java-spanner</url>
1010
<description>Java idiomatic client for Google Cloud Spanner.</description>
1111
<parent>
1212
<groupId>com.google.cloud</groupId>
1313
<artifactId>google-cloud-spanner-parent</artifactId>
14-
<version>6.3.4-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
14+
<version>6.4.1-SNAPSHOT</version><!-- {x-version-update:google-cloud-spanner:current} -->
1515
</parent>
1616
<properties>
1717
<site.installationModule>google-cloud-spanner</site.installationModule>
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static Type timestamp() {
116116

117117
/**
118118
* Returns the descriptor for the {@code DATE} type: a timezone independent date in the range
119-
* [1678-01-01, 2262-01-01).
119+
* [0001-01-01, 9999-12-31).
120120
*/
121121
public static Type date() {
122122
return TYPE_DATE;
Original file line numberDiff line numberDiff line change
@@ -1638,17 +1638,17 @@ private Value getValue(int fieldIndex) {
16381638
Type elementType = fieldType.getArrayElementType();
16391639
switch (elementType.getCode()) {
16401640
case BOOL:
1641-
return Value.boolArray(value.getBooleanArray(fieldIndex));
1641+
return Value.boolArray(value.getBooleanList(fieldIndex));
16421642
case INT64:
1643-
return Value.int64Array(value.getLongArray(fieldIndex));
1643+
return Value.int64Array(value.getLongList(fieldIndex));
16441644
case STRING:
16451645
return Value.stringArray(value.getStringList(fieldIndex));
16461646
case JSON:
16471647
return Value.jsonArray(value.getJsonList(fieldIndex));
16481648
case BYTES:
16491649
return Value.bytesArray(value.getBytesList(fieldIndex));
16501650
case FLOAT64:
1651-
return Value.float64Array(value.getDoubleArray(fieldIndex));
1651+
return Value.float64Array(value.getDoubleList(fieldIndex));
16521652
case NUMERIC:
16531653
return Value.numericArray(value.getBigDecimalList(fieldIndex));
16541654
case DATE:
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
import java.util.LinkedList;
167167
import java.util.List;
168168
import java.util.Map;
169+
import java.util.Map.Entry;
169170
import java.util.Set;
170171
import java.util.concurrent.Callable;
171172
import java.util.concurrent.CancellationException;
@@ -493,7 +494,14 @@ public <RequestT, ResponseT> UnaryCallable<RequestT, ResponseT> createUnaryCalla
493494

494495
private static HeaderProvider headerProviderWithUserAgentFrom(HeaderProvider headerProvider) {
495496
final Map<String, String> headersWithUserAgent = new HashMap<>(headerProvider.getHeaders());
496-
final String userAgent = headersWithUserAgent.get(USER_AGENT_KEY);
497+
String userAgent = null;
498+
for (Entry<String, String> entry : headersWithUserAgent.entrySet()) {
499+
if (entry.getKey().equalsIgnoreCase(USER_AGENT_KEY)) {
500+
userAgent = entry.getValue();
501+
headersWithUserAgent.remove(entry.getKey());
502+
break;
503+
}
504+
}
497505
headersWithUserAgent.put(
498506
USER_AGENT_KEY,
499507
userAgent == null ? DEFAULT_USER_AGENT : userAgent + " " + DEFAULT_USER_AGENT);
Original file line numberDiff line numberDiff line change
@@ -1416,6 +1416,51 @@ public void testDatabaseOrInstanceIsDeletedAndThenRecreated() throws Exception {
14161416
}
14171417
}
14181418

1419+
@Test
1420+
public void testGetInvalidatedClientMultipleTimes() {
1421+
StatusRuntimeException[] exceptions =
1422+
new StatusRuntimeException[] {
1423+
SpannerExceptionFactoryTest.newStatusResourceNotFoundException(
1424+
"Database", SpannerExceptionFactory.DATABASE_RESOURCE_TYPE, DATABASE_NAME),
1425+
SpannerExceptionFactoryTest.newStatusResourceNotFoundException(
1426+
"Instance", SpannerExceptionFactory.INSTANCE_RESOURCE_TYPE, INSTANCE_NAME)
1427+
};
1428+
for (StatusRuntimeException exception : exceptions) {
1429+
mockSpanner.setBatchCreateSessionsExecutionTime(
1430+
SimulatedExecutionTime.ofStickyException(exception));
1431+
try (Spanner spanner =
1432+
SpannerOptions.newBuilder()
1433+
.setProjectId(TEST_PROJECT)
1434+
.setChannelProvider(channelProvider)
1435+
.setCredentials(NoCredentials.getInstance())
1436+
.setSessionPoolOption(SessionPoolOptions.newBuilder().setMinSessions(0).build())
1437+
.build()
1438+
.getService()) {
1439+
for (int run = 0; run < 2; run++) {
1440+
DatabaseClientImpl dbClient =
1441+
(DatabaseClientImpl)
1442+
spanner.getDatabaseClient(
1443+
DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE));
1444+
for (int useClient = 0; useClient < 2; useClient++) {
1445+
// Using the same client multiple times should continue to return the same
1446+
// ResourceNotFoundException, even though the session pool has been invalidated.
1447+
try (ResultSet rs = dbClient.singleUse().executeQuery(SELECT1)) {
1448+
rs.next();
1449+
fail("missing expected exception");
1450+
} catch (DatabaseNotFoundException | InstanceNotFoundException e) {
1451+
// The server should only receive one BatchCreateSessions request for each run as we
1452+
// have set MinSessions=0.
1453+
assertThat(mockSpanner.getRequests()).hasSize(run + 1);
1454+
assertThat(dbClient.pool.isValid()).isFalse();
1455+
}
1456+
}
1457+
}
1458+
}
1459+
mockSpanner.reset();
1460+
mockSpanner.removeAllExecutionTimes();
1461+
}
1462+
}
1463+
14191464
@Test
14201465
public void testAllowNestedTransactions() throws InterruptedException {
14211466
final DatabaseClientImpl client =

0 commit comments

Comments
 (0)