Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit 3abfd4e

Browse files
committed
fix: remove merge conflict markers and cleanup
1 parent 35f26ef commit 3abfd4e

7 files changed

Lines changed: 58 additions & 32 deletions

File tree

google-cloud-spanner/clirr-ignored-differences.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,4 @@
578578
<className>com/google/cloud/spanner/connection/Connection</className>
579579
<method>com.google.api.core.ApiFuture closeAsync()</method>
580580
</difference>
581-
=======
582-
>>>>>>> 046aac8e... feat: add support for RPC priority
583581
</differences>

google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClient.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,16 @@ public interface DatabaseClient {
8181
* Options.priority(RpcPriority.HIGH));
8282
* }</pre>
8383
*
84+
* Options for a transaction can include:
85+
*
86+
* <ul>
87+
* <li>{@link Options#priority(com.google.cloud.spanner.Options.RpcPriority)}: The {@link
88+
* RpcPriority} to use for the commit request of the transaction. The priority will not be
89+
* applied to any other requests on the transaction.
90+
* <li>{@link Options#commitStats()}: Request that the server includes commit statistics in the
91+
* {@link CommitResponse}.
92+
* </ul>
93+
*
8494
* @return a response with the timestamp at which the write was committed
8595
*/
8696
CommitResponse writeWithOptions(Iterable<Mutation> mutations, TransactionOption... options)
@@ -146,6 +156,16 @@ CommitResponse writeWithOptions(Iterable<Mutation> mutations, TransactionOption.
146156
* Options.priority(RpcPriority.LOW));
147157
* }</pre>
148158
*
159+
* Options for a transaction can include:
160+
*
161+
* <ul>
162+
* <li>{@link Options#priority(com.google.cloud.spanner.Options.RpcPriority)}: The {@link
163+
* RpcPriority} to use for the commit request of the transaction. The priority will not be
164+
* applied to any other requests on the transaction.
165+
* <li>{@link Options#commitStats()}: Request that the server includes commit statistics in the
166+
* {@link CommitResponse}.
167+
* </ul>
168+
*
149169
* @return a response with the timestamp at which the write was committed
150170
*/
151171
CommitResponse writeAtLeastOnceWithOptions(
@@ -320,6 +340,8 @@ CommitResponse writeAtLeastOnceWithOptions(
320340
* <li>{@link Options#priority(com.google.cloud.spanner.Options.RpcPriority)}: The {@link
321341
* RpcPriority} to use for the commit request of the transaction. The priority will not be
322342
* applied to any other requests on the transaction.
343+
* <li>{@link Options#commitStats()}: Request that the server includes commit statistics in the
344+
* {@link CommitResponse}.
323345
* </ul>
324346
*/
325347
TransactionRunner readWriteTransaction(TransactionOption... options);
@@ -358,6 +380,8 @@ CommitResponse writeAtLeastOnceWithOptions(
358380
* <li>{@link Options#priority(com.google.cloud.spanner.Options.RpcPriority)}: The {@link
359381
* RpcPriority} to use for the commit request of the transaction. The priority will not be
360382
* applied to any other requests on the transaction.
383+
* <li>{@link Options#commitStats()}: Request that the server includes commit statistics in the
384+
* {@link CommitResponse}.
361385
* </ul>
362386
*/
363387
TransactionManager transactionManager(TransactionOption... options);
@@ -399,6 +423,8 @@ CommitResponse writeAtLeastOnceWithOptions(
399423
* <li>{@link Options#priority(com.google.cloud.spanner.Options.RpcPriority)}: The {@link
400424
* RpcPriority} to use for the commit request of the transaction. The priority will not be
401425
* applied to any other requests on the transaction.
426+
* <li>{@link Options#commitStats()}: Request that the server includes commit statistics in the
427+
* {@link CommitResponse}.
402428
* </ul>
403429
*/
404430
AsyncRunner runAsync(TransactionOption... options);
@@ -491,10 +517,14 @@ CommitResponse writeAtLeastOnceWithOptions(
491517
*
492518
* Options for a transaction can include:
493519
*
520+
* <p>Options for a transaction can include:
521+
*
494522
* <ul>
495523
* <li>{@link Options#priority(com.google.cloud.spanner.Options.RpcPriority)}: The {@link
496524
* RpcPriority} to use for the commit request of the transaction. The priority will not be
497525
* applied to any other requests on the transaction.
526+
* <li>{@link Options#commitStats()}: Request that the server includes commit statistics in the
527+
* {@link CommitResponse}.
498528
* </ul>
499529
*/
500530
AsyncTransactionManager transactionManagerAsync(TransactionOption... options);

google-cloud-spanner/src/main/java/com/google/cloud/spanner/Options.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
public final class Options implements Serializable {
2626
private static final long serialVersionUID = 8067099123096783941L;
2727

28-
/** Priority for an RPC. */
28+
/**
29+
* Priority for an RPC invocation. The default priority is {@link #HIGH}. This enum can be used to
30+
* set a lower priority for a specific RPC invocation.
31+
*/
2932
public enum RpcPriority {
3033
LOW(Priority.PRIORITY_LOW),
3134
MEDIUM(Priority.PRIORITY_MEDIUM),

google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ public CommitResponse writeAtLeastOnceWithOptions(
182182
com.google.spanner.v1.CommitResponse response =
183183
spanner.getRpc().commit(requestBuilder.build(), this.options);
184184
return new CommitResponse(response);
185-
} catch (IllegalArgumentException e) {
186-
TraceUtil.setWithFailure(span, e);
187-
throw newSpannerException(ErrorCode.INTERNAL, "Could not parse commit timestamp", e);
188185
} catch (RuntimeException e) {
189186
TraceUtil.setWithFailure(span, e);
190187
throw e;

google-cloud-spanner/src/test/java/com/google/cloud/spanner/BaseSessionPoolTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ SessionImpl mockSession() {
6969
.thenReturn(new CommitResponse(com.google.spanner.v1.CommitResponse.getDefaultInstance()));
7070
when(session.writeAtLeastOnceWithOptions(any(Iterable.class)))
7171
.thenReturn(new CommitResponse(com.google.spanner.v1.CommitResponse.getDefaultInstance()));
72-
when(session.writeAtLeastOnceWithOptions(any(Iterable.class)))
73-
.thenReturn(new CommitResponse(com.google.spanner.v1.CommitResponse.getDefaultInstance()));
7472
sessionIndex++;
7573
return session;
7674
}

google-cloud-spanner/src/test/java/com/google/cloud/spanner/DatabaseClientImplTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,9 +1709,9 @@ public void testTransactionManagerAsync_usesOptions() {
17091709
public void testExecuteQueryWithPriority() {
17101710
DatabaseClient client =
17111711
spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE));
1712-
try (ResultSet rs =
1712+
try (ResultSet resultSet =
17131713
client.singleUse().executeQuery(SELECT1, Options.priority(RpcPriority.HIGH))) {
1714-
while (rs.next()) {}
1714+
while (resultSet.next()) {}
17151715
}
17161716

17171717
List<ExecuteSqlRequest> requests = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class);
@@ -1725,15 +1725,15 @@ public void testExecuteQueryWithPriority() {
17251725
public void testExecuteReadWithPriority() {
17261726
DatabaseClient client =
17271727
spanner.getDatabaseClient(DatabaseId.of(TEST_PROJECT, TEST_INSTANCE, TEST_DATABASE));
1728-
try (ResultSet rs =
1728+
try (ResultSet resultSet =
17291729
client
17301730
.singleUse()
17311731
.read(
17321732
READ_TABLE_NAME,
17331733
KeySet.singleKey(Key.of(1L)),
17341734
READ_COLUMN_NAMES,
17351735
Options.priority(RpcPriority.HIGH))) {
1736-
while (rs.next()) {}
1736+
while (resultSet.next()) {}
17371737
}
17381738

17391739
List<ReadRequest> requests = mockSpanner.getRequestsOfType(ReadRequest.class);
@@ -1752,9 +1752,9 @@ public void testReadWriteExecuteQueryWithPriority() {
17521752
new TransactionCallable<Void>() {
17531753
@Override
17541754
public Void run(TransactionContext transaction) throws Exception {
1755-
try (ResultSet rs =
1755+
try (ResultSet resultSet =
17561756
transaction.executeQuery(SELECT1, Options.priority(RpcPriority.HIGH))) {
1757-
while (rs.next()) {}
1757+
while (resultSet.next()) {}
17581758
}
17591759
return null;
17601760
}
@@ -1776,13 +1776,13 @@ public void testReadWriteExecuteReadWithPriority() {
17761776
new TransactionCallable<Void>() {
17771777
@Override
17781778
public Void run(TransactionContext transaction) throws Exception {
1779-
try (ResultSet rs =
1779+
try (ResultSet resultSet =
17801780
transaction.read(
17811781
READ_TABLE_NAME,
17821782
KeySet.singleKey(Key.of(1L)),
17831783
READ_COLUMN_NAMES,
17841784
Options.priority(RpcPriority.HIGH))) {
1785-
while (rs.next()) {}
1785+
while (resultSet.next()) {}
17861786
}
17871787
return null;
17881788
}

google-cloud-spanner/src/test/java/com/google/cloud/spanner/OptionsTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -491,23 +491,23 @@ public void testTransactionOptions() {
491491
}
492492

493493
@Test
494-
public void testTransactionOptionsEquality() {
495-
Options o1;
496-
Options o2;
497-
Options o3;
498-
499-
o1 = Options.fromTransactionOptions();
500-
o2 = Options.fromTransactionOptions();
501-
assertThat(o1.equals(o2)).isTrue();
502-
503-
o2 = Options.fromTransactionOptions(Options.priority(RpcPriority.HIGH));
504-
assertThat(o1.equals(o2)).isFalse();
505-
assertThat(o2.equals(o1)).isFalse();
494+
public void testTransactionOptionsDefaultEqual() {
495+
Options options1 = Options.fromTransactionOptions();
496+
Options options2 = Options.fromTransactionOptions();
497+
assertEquals(options1, options2);
498+
}
506499

507-
o3 = Options.fromTransactionOptions(Options.priority(RpcPriority.HIGH));
508-
assertThat(o2.equals(o3)).isTrue();
500+
@Test
501+
public void testTransactionOptionsPriorityEquality() {
502+
Options options1 = Options.fromTransactionOptions(Options.priority(RpcPriority.HIGH));
503+
Options options2 = Options.fromTransactionOptions(Options.priority(RpcPriority.HIGH));
504+
Options options3 = Options.fromTransactionOptions();
505+
Options options4 = Options.fromTransactionOptions(Options.priority(RpcPriority.LOW));
509506

510-
o3 = Options.fromTransactionOptions(Options.priority(RpcPriority.LOW));
511-
assertThat(o2.equals(o3)).isFalse();
507+
assertEquals(options1, options2);
508+
assertNotEquals(options1, options3);
509+
assertNotEquals(options1, options4);
510+
assertNotEquals(options2, options3);
511+
assertNotEquals(options2, options4);
512512
}
513513
}

0 commit comments

Comments
 (0)