diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java index caf0e06379e..270e5a2b6d9 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractReadContext.java @@ -48,6 +48,7 @@ import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.ExecuteSqlRequest.QueryMode; import com.google.spanner.v1.ExecuteSqlRequest.QueryOptions; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.PartialResultSet; import com.google.spanner.v1.ReadRequest; import com.google.spanner.v1.RequestOptions; @@ -878,10 +879,19 @@ String getTransactionTag() { return null; } + @Nullable + MultiplexedSessionPrecommitToken getLatestPrecommitToken() { + return null; + } + /** This method is called when a statement returned a new transaction as part of its results. */ @Override public void onTransactionMetadata(Transaction transaction, boolean shouldIncludeId) {} + /** This method is called when a response returns a new pre-commit token as part of its results. */ + @Override + public void onPrecommitToken(MultiplexedSessionPrecommitToken token){} + @Override public SpannerException onError(SpannerException e, boolean withBeginTransaction) { this.session.onError(e); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java index 2cf93fb92ec..47067b0c0b4 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/AbstractResultSet.java @@ -27,6 +27,7 @@ import com.google.protobuf.ListValue; import com.google.protobuf.ProtocolMessageEnum; import com.google.protobuf.Value.KindCase; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.Transaction; import java.io.IOException; import java.io.Serializable; @@ -52,6 +53,8 @@ interface Listener { void onTransactionMetadata(Transaction transaction, boolean shouldIncludeId) throws SpannerException; + void onPrecommitToken(MultiplexedSessionPrecommitToken token); + /** Called when the read finishes with an error. Returns the error that should be thrown. */ SpannerException onError(SpannerException e, boolean withBeginTransaction); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java index 909d731818f..f0ceb72eea2 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/DatabaseClientImpl.java @@ -241,7 +241,7 @@ public ReadOnlyTransaction readOnlyTransaction(TimestampBound bound) { public TransactionRunner readWriteTransaction(TransactionOption... options) { ISpan span = tracer.spanBuilder(READ_WRITE_TRANSACTION, options); try (IScope s = tracer.withSpan(span)) { - return getSession().readWriteTransaction(options); + return getMultiplexedSession().readWriteTransaction(options); } catch (RuntimeException e) { span.setStatus(e); span.end(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcResultSet.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcResultSet.java index be75c1e5c4e..23c9dd7c2d3 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcResultSet.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcResultSet.java @@ -47,7 +47,7 @@ class GrpcResultSet extends AbstractResultSet> implements ProtobufR GrpcResultSet( CloseableIterator iterator, Listener listener, DecodeMode decodeMode) { - this.iterator = new GrpcValueIterator(iterator); + this.iterator = new GrpcValueIterator(iterator, listener); this.listener = listener; this.decodeMode = decodeMode; } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcValueIterator.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcValueIterator.java index 0a2e17bd2b5..b78a1e1d73f 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcValueIterator.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/GrpcValueIterator.java @@ -20,9 +20,11 @@ import static com.google.common.base.Preconditions.checkState; import com.google.cloud.spanner.AbstractResultSet.CloseableIterator; +import com.google.cloud.spanner.AbstractResultSet.Listener; import com.google.common.collect.AbstractIterator; import com.google.protobuf.ListValue; import com.google.protobuf.Value.KindCase; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.PartialResultSet; import com.google.spanner.v1.ResultSetMetadata; import com.google.spanner.v1.ResultSetStats; @@ -44,9 +46,12 @@ private enum StreamValue { private PartialResultSet current; private int pos; private ResultSetStats statistics; + private MultiplexedSessionPrecommitToken precommitToken; + private final Listener listener; - GrpcValueIterator(CloseableIterator stream) { + GrpcValueIterator(CloseableIterator stream, Listener listener) { this.stream = stream; + this.listener = listener; } @SuppressWarnings("unchecked") @@ -154,6 +159,10 @@ private boolean ensureReady(StreamValue requiredValue) throws SpannerException { ErrorCode.INTERNAL, "Invalid type metadata: " + e.getMessage(), e); } } + // Collect precommit token from all PartialResultSet + if(current.hasPrecommitToken()) { + listener.onPrecommitToken(current.getPrecommitToken()); + } if (current.hasStats()) { statistics = current.getStats(); } diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java index 81415e80d25..08f96b6e021 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClient.java @@ -404,6 +404,11 @@ public ReadOnlyTransaction readOnlyTransaction(TimestampBound bound) { return createMultiplexedSessionTransaction(false).readOnlyTransaction(bound); } + @Override + public TransactionRunner readWriteTransaction(TransactionOption... options) { + return createMultiplexedSessionTransaction(false).readWriteTransaction(options); + } + /** * It is enough with one executor to maintain the multiplexed sessions in all the clients, as they * do not need to be updated often, and the maintenance task is light. The core pool size is set diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java index 7b9abc71a85..4d6acba96a7 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionImpl.java @@ -426,15 +426,18 @@ public void close() { } } - ApiFuture beginTransactionAsync( - Options transactionOptions, boolean routeToLeader, Map channelHint) { - final SettableApiFuture res = SettableApiFuture.create(); + ApiFuture beginTransactionAsync( + Options transactionOptions, boolean routeToLeader, Map channelHint, com.google.spanner.v1.Mutation mutation) { + final SettableApiFuture res = SettableApiFuture.create(); final ISpan span = tracer.spanBuilder(SpannerImpl.BEGIN_TRANSACTION); - final BeginTransactionRequest request = + BeginTransactionRequest request = BeginTransactionRequest.newBuilder() .setSession(getName()) .setOptions(createReadWriteTransactionOptions(transactionOptions)) .build(); + if (sessionReference.getIsMultiplexed()) { + request = request.toBuilder().setMutationKey(mutation).build(); + } final ApiFuture requestFuture; try (IScope ignore = tracer.withSpan(span)) { requestFuture = spanner.getRpc().beginTransactionAsync(request, channelHint, routeToLeader); @@ -448,7 +451,7 @@ ApiFuture beginTransactionAsync( ErrorCode.INTERNAL, "Missing id in transaction\n" + getName()); } span.end(); - res.set(txn.getId()); + res.set(txn); } catch (ExecutionException e) { span.setStatus(e); span.end(); diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java index c8bf6dc833b..f3ec6013142 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TransactionRunnerImpl.java @@ -46,6 +46,7 @@ import com.google.spanner.v1.ExecuteBatchDmlResponse; import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.ExecuteSqlRequest.QueryMode; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.RequestOptions; import com.google.spanner.v1.ResultSet; import com.google.spanner.v1.ResultSetStats; @@ -171,6 +172,11 @@ public void removeListener(Runnable listener) { @GuardedBy("committingLock") private volatile boolean committing; + private final Object preCommitTokenLock = new Object(); + + @GuardedBy("preCommitTokenLock") + private MultiplexedSessionPrecommitToken latestPreCommitToken; + @GuardedBy("lock") private volatile SettableApiFuture finishedAsyncOperations = SettableApiFuture.create(); @@ -268,7 +274,7 @@ void ensureTxn() { ApiFuture ensureTxnAsync() { final SettableApiFuture res = SettableApiFuture.create(); if (transactionId == null || isAborted()) { - createTxnAsync(res); + createTxnAsync(res, null); } else { span.addAnnotation("Transaction Initialized", "Id", transactionId.toStringUtf8()); txnLogger.log( @@ -280,19 +286,23 @@ ApiFuture ensureTxnAsync() { return res; } - private void createTxnAsync(final SettableApiFuture res) { + private void createTxnAsync(final SettableApiFuture res, com.google.spanner.v1.Mutation mutation) { span.addAnnotation("Creating Transaction"); - final ApiFuture fut = - session.beginTransactionAsync(options, isRouteToLeader(), getTransactionChannelHint()); + final ApiFuture fut = + session.beginTransactionAsync(options, isRouteToLeader(), getTransactionChannelHint(), mutation); fut.addListener( () -> { try { - transactionId = fut.get(); + Transaction txn = fut.get(); + transactionId = txn.getId(); span.addAnnotation("Transaction Creation Done", "Id", transactionId.toStringUtf8()); txnLogger.log( Level.FINER, "Started transaction {0}", txnLogger.isLoggable(Level.FINER) ? transactionId.asReadOnlyByteBuffer() : null); + if (txn.hasPrecommitToken()) { + onPrecommitToken(txn.getPrecommitToken()); + } res.set(null); } catch (ExecutionException e) { span.addAnnotation( @@ -370,7 +380,7 @@ ApiFuture commitAsync() { synchronized (lock) { if (transactionIdFuture == null && transactionId == null && runningAsyncOperations == 0) { finishOps = SettableApiFuture.create(); - createTxnAsync(finishOps); + createTxnAsync(finishOps, mutationsProto.get(0)); } else { finishOps = finishedAsyncOperations; } @@ -423,6 +433,13 @@ public void run() { } requestBuilder.setRequestOptions(requestOptionsBuilder.build()); } + if (session.getIsMultiplexed()) { + requestBuilder.setPrecommitToken(getLatestPrecommitToken()); + System.out.println("setting precommit token in request"); + System.out.println(requestBuilder.getPrecommitToken().getPrecommitToken()); + + txnLogger.log(Level.ALL, "setting precommit token to commit "+requestBuilder.getPrecommitToken().getPrecommitToken()); + } final CommitRequest commitRequest = requestBuilder.build(); span.addAnnotation("Starting Commit"); final ApiFuture commitFuture; @@ -625,6 +642,17 @@ public void onTransactionMetadata(Transaction transaction, boolean shouldInclude } } + public void onPrecommitToken(MultiplexedSessionPrecommitToken token){ + if(token == null) return; + synchronized (preCommitTokenLock) { + if (this.latestPreCommitToken == null || token.getSeqNum() > this.latestPreCommitToken.getSeqNum()) { + this.latestPreCommitToken = token; + System.out.println("Updating precommit token to "+this.latestPreCommitToken); + txnLogger.log(Level.ALL, "Updating precommit token to "+this.latestPreCommitToken); + } + } + } + @Nullable String getTransactionTag() { if (this.options.hasTag()) { @@ -633,6 +661,13 @@ String getTransactionTag() { return null; } + @Nullable + MultiplexedSessionPrecommitToken getLatestPrecommitToken() { + synchronized (preCommitTokenLock) { + return this.latestPreCommitToken; + } + } + @Override public SpannerException onError(SpannerException e, boolean withBeginTransaction) { e = super.onError(e, withBeginTransaction); @@ -811,6 +846,9 @@ private ResultSet internalExecuteUpdate( throw new IllegalArgumentException( "DML response missing stats possibly due to non-DML statement as input"); } + if (resultSet.hasPrecommitToken()) { + onPrecommitToken(resultSet.getPrecommitToken()); + } return resultSet; } catch (Throwable t) { throw onError( @@ -885,6 +923,9 @@ public ApiFuture executeUpdateAsync(Statement statement, UpdateOption... u resultSet.get().getMetadata().getTransaction(), builder.getTransaction().hasBegin()); } + if (resultSet.get().hasPrecommitToken()) { + onPrecommitToken(resultSet.get().getPrecommitToken()); + } } catch (Throwable e) { // Ignore this error here as it is handled by the future that is returned by the // executeUpdateAsync method. @@ -938,6 +979,10 @@ public long[] batchUpdate(Iterable statements, UpdateOption... update response.getResultSets(i).getMetadata().getTransaction(), builder.getTransaction().hasBegin()); } + // TODO(harsha): check if we need to get precommit_token from response.getResultSets + if (response.hasPrecommitToken()) { + onPrecommitToken(response.getPrecommitToken()); + } } // If one of the DML statements was aborted, we should throw an aborted exception. @@ -1004,6 +1049,9 @@ public ApiFuture batchUpdateAsync( builder.getTransaction().hasBegin()); } } + if (batchDmlResponse.hasPrecommitToken()) { + onPrecommitToken(batchDmlResponse.getPrecommitToken()); + } // If one of the DML statements was aborted, we should throw an aborted exception. // In all other cases, we should throw a BatchUpdateException. if (batchDmlResponse.getStatus().getCode() == Code.ABORTED_VALUE) { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java index 64ffdb0902a..8625c17785a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java @@ -1629,6 +1629,7 @@ public final Transaction beginTransaction(String session, TransactionOptions opt * SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").toString()) * .setOptions(TransactionOptions.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setMutationKey(Mutation.newBuilder().build()) * .build(); * Transaction response = spannerClient.beginTransaction(request); * } @@ -1662,6 +1663,7 @@ public final Transaction beginTransaction(BeginTransactionRequest request) { * SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]").toString()) * .setOptions(TransactionOptions.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setMutationKey(Mutation.newBuilder().build()) * .build(); * ApiFuture future = spannerClient.beginTransactionCallable().futureCall(request); * // Do something. @@ -1911,6 +1913,7 @@ public final CommitResponse commit( * .setReturnCommitStats(true) * .setMaxCommitDelay(Duration.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) * .build(); * CommitResponse response = spannerClient.commit(request); * } @@ -1955,6 +1958,7 @@ public final CommitResponse commit(CommitRequest request) { * .setReturnCommitStats(true) * .setMaxCommitDelay(Duration.newBuilder().build()) * .setRequestOptions(RequestOptions.newBuilder().build()) + * .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) * .build(); * ApiFuture future = spannerClient.commitCallable().futureCall(request); * // Do something. diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java index a785ff6d993..721e874e01e 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerSettings.java @@ -76,7 +76,9 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createSession to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createSession: * *

{@code
  * // This snippet has been automatically generated and should be regarded as a code template only.
@@ -92,10 +94,21 @@
  *             .createSessionSettings()
  *             .getRetrySettings()
  *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * SpannerSettings spannerSettings = spannerSettingsBuilder.build();
  * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for + * additional support in setting retries. */ @Generated("by gapic-generator-java") public class SpannerSettings extends ClientSettings { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java index fa6b86633b3..ae4b1c11daf 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/stub/SpannerStubSettings.java @@ -94,7 +94,9 @@ *

The builder of this class is recursive, so contained classes are themselves builders. When * build() is called, the tree of builders is called to create the complete settings object. * - *

For example, to set the total timeout of createSession to 30 seconds: + *

For example, to set the + * [RetrySettings](https://cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.retrying.RetrySettings) + * of createSession: * *

{@code
  * // This snippet has been automatically generated and should be regarded as a code template only.
@@ -110,10 +112,21 @@
  *             .createSessionSettings()
  *             .getRetrySettings()
  *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .setInitialRetryDelayDuration(Duration.ofSeconds(1))
+ *             .setInitialRpcTimeoutDuration(Duration.ofSeconds(5))
+ *             .setMaxAttempts(5)
+ *             .setMaxRetryDelayDuration(Duration.ofSeconds(30))
+ *             .setMaxRpcTimeoutDuration(Duration.ofSeconds(60))
+ *             .setRetryDelayMultiplier(1.3)
+ *             .setRpcTimeoutMultiplier(1.5)
+ *             .setTotalTimeoutDuration(Duration.ofSeconds(300))
  *             .build());
  * SpannerStubSettings spannerSettings = spannerSettingsBuilder.build();
  * }
+ * + * Please refer to the [Client Side Retry + * Guide](https://github.com/googleapis/google-cloud-java/blob/main/docs/client_retries.md) for + * additional support in setting retries. */ @Generated("by gapic-generator-java") public class SpannerStubSettings extends StubSettings { @@ -177,9 +190,7 @@ public String extractNextToken(ListSessionsResponse payload) { @Override public Iterable extractResources(ListSessionsResponse payload) { - return payload.getSessionsList() == null - ? ImmutableList.of() - : payload.getSessionsList(); + return payload.getSessionsList(); } }; diff --git a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json index 4e56610da8f..ffa070f1225 100644 --- a/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json +++ b/google-cloud-spanner/src/main/resources/META-INF/native-image/com.google.cloud.spanner.v1/reflect-config.json @@ -305,6 +305,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.api.PythonSettings$ExperimentalFeatures", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.api.PythonSettings$ExperimentalFeatures$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.api.ResourceDescriptor", "queryAllDeclaredConstructors": true, @@ -1727,6 +1745,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.spanner.v1.MultiplexedSessionPrecommitToken", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.spanner.v1.MultiplexedSessionPrecommitToken$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.spanner.v1.Mutation", "queryAllDeclaredConstructors": true, diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/CloseSpannerWithOpenResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/CloseSpannerWithOpenResultSetTest.java index 67b14f60a4e..a489a269b22 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/CloseSpannerWithOpenResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/CloseSpannerWithOpenResultSetTest.java @@ -39,6 +39,8 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.junit.After; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -59,6 +61,16 @@ Spanner createSpanner() { .getService(); } + @BeforeClass + public static void setWatchdogTimeout() { + System.setProperty("com.google.cloud.spanner.watchdogTimeoutSeconds", "1"); + } + + @AfterClass + public static void clearWatchdogTimeout() { + System.clearProperty("com.google.cloud.spanner.watchdogTimeoutSeconds"); + } + @After public void cleanup() { mockSpanner.unfreeze(); @@ -75,7 +87,13 @@ public void testBatchClient_closedSpannerWithOpenResultSet_streamsAreCancelled() client.batchReadOnlyTransaction(TimestampBound.strong()); ResultSet resultSet = transaction.executeQuery(SELECT_RANDOM_STATEMENT)) { mockSpanner.freezeAfterReturningNumRows(1); - assertTrue(resultSet.next()); + // This can sometimes fail, as the mock server may not always actually return the first row. + try { + assertTrue(resultSet.next()); + } catch (SpannerException exception) { + assertEquals(ErrorCode.DEADLINE_EXCEEDED, exception.getErrorCode()); + return; + } ((SpannerImpl) spanner).close(1, TimeUnit.MILLISECONDS); // This should return an error as the stream is cancelled. SpannerException exception = assertThrows(SpannerException.class, resultSet::next); @@ -93,7 +111,13 @@ public void testNormalDatabaseClient_closedSpannerWithOpenResultSet_sessionsAreD try (ReadOnlyTransaction transaction = client.readOnlyTransaction(TimestampBound.strong()); ResultSet resultSet = transaction.executeQuery(SELECT_RANDOM_STATEMENT)) { mockSpanner.freezeAfterReturningNumRows(1); - assertTrue(resultSet.next()); + // This can sometimes fail, as the mock server may not always actually return the first row. + try { + assertTrue(resultSet.next()); + } catch (SpannerException exception) { + assertEquals(ErrorCode.DEADLINE_EXCEEDED, exception.getErrorCode()); + return; + } List executeSqlRequests = mockSpanner.getRequestsOfType(ExecuteSqlRequest.class).stream() .filter(request -> request.getSql().equals(SELECT_RANDOM_STATEMENT.getSql())) diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java index 62336163eaf..88b9c8d21e3 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/GrpcResultSetTest.java @@ -36,6 +36,7 @@ import com.google.common.collect.ImmutableMap; import com.google.protobuf.ByteString; import com.google.spanner.v1.ExecuteSqlRequest.QueryMode; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.PartialResultSet; import com.google.spanner.v1.QueryPlan; import com.google.spanner.v1.ResultSetMetadata; @@ -70,6 +71,9 @@ private static class NoOpListener implements AbstractResultSet.Listener { public void onTransactionMetadata(Transaction transaction, boolean shouldIncludeId) throws SpannerException {} + @Override + public void onPrecommitToken(MultiplexedSessionPrecommitToken token) {} + @Override public SpannerException onError(SpannerException e, boolean withBeginTransaction) { return e; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ReadFormatTestRunner.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ReadFormatTestRunner.java index c973b7e471e..1044827dbc1 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ReadFormatTestRunner.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ReadFormatTestRunner.java @@ -24,6 +24,7 @@ import com.google.cloud.spanner.spi.v1.SpannerRpc; import com.google.common.io.Resources; import com.google.protobuf.util.JsonFormat; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.PartialResultSet; import com.google.spanner.v1.Transaction; import java.math.BigDecimal; @@ -49,6 +50,9 @@ private static class NoOpListener implements AbstractResultSet.Listener { public void onTransactionMetadata(Transaction transaction, boolean shouldIncludeId) throws SpannerException {} + @Override + public void onPrecommitToken(MultiplexedSessionPrecommitToken token) {} + @Override public SpannerException onError(SpannerException e, boolean withBeginTransaction) { return e; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsHelper.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsHelper.java index fc494c6f3ff..647c0b93b98 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsHelper.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/ResultSetsHelper.java @@ -19,6 +19,7 @@ import com.google.cloud.spanner.AbstractResultSet.CloseableIterator; import com.google.cloud.spanner.AbstractResultSet.Listener; import com.google.protobuf.ListValue; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.PartialResultSet; import com.google.spanner.v1.Transaction; import java.util.Iterator; @@ -75,6 +76,9 @@ public PartialResultSet next() { public void onTransactionMetadata(Transaction transaction, boolean shouldIncludeId) throws SpannerException {} + @Override + public void onPrecommitToken(MultiplexedSessionPrecommitToken token) {} + @Override public SpannerException onError(SpannerException e, boolean withBeginTransaction) { return e; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java index 998678e4296..becce6e0488 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/SessionPoolTest.java @@ -87,6 +87,7 @@ import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.ResultSetStats; import com.google.spanner.v1.RollbackRequest; +import com.google.spanner.v1.Transaction; import io.opencensus.metrics.LabelValue; import io.opencensus.metrics.MetricRegistry; import io.opencensus.metrics.Metrics; @@ -1497,7 +1498,7 @@ public void testSessionNotFoundReadWriteTransaction() { .thenReturn(ApiFutures.immediateFuture(Empty.getDefaultInstance())); when(closedSession.newTransaction(Options.fromTransactionOptions())) .thenReturn(closedTransactionContext); - when(closedSession.beginTransactionAsync(any(), eq(true), any())).thenThrow(sessionNotFound); + when(closedSession.beginTransactionAsync(any(), eq(true), any(), any())).thenThrow(sessionNotFound); when(closedSession.getTracer()).thenReturn(tracer); TransactionRunnerImpl closedTransactionRunner = new TransactionRunnerImpl(closedSession); closedTransactionRunner.setSpan(span); @@ -1512,8 +1513,8 @@ public void testSessionNotFoundReadWriteTransaction() { final TransactionContextImpl openTransactionContext = mock(TransactionContextImpl.class); when(openSession.newTransaction(Options.fromTransactionOptions())) .thenReturn(openTransactionContext); - when(openSession.beginTransactionAsync(any(), eq(true), any())) - .thenReturn(ApiFutures.immediateFuture(ByteString.copyFromUtf8("open-txn"))); + when(openSession.beginTransactionAsync(any(), eq(true), any(), any())) + .thenReturn(ApiFutures.immediateFuture(Transaction.getDefaultInstance())); when(openSession.getTracer()).thenReturn(tracer); TransactionRunnerImpl openTransactionRunner = new TransactionRunnerImpl(openSession); openTransactionRunner.setSpan(span); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java index 3b5f106f13f..1683d533855 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientHttpJsonTest.java @@ -44,6 +44,7 @@ import com.google.spanner.v1.ExecuteSqlRequest; import com.google.spanner.v1.KeySet; import com.google.spanner.v1.ListSessionsResponse; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.Mutation; import com.google.spanner.v1.Partition; import com.google.spanner.v1.PartitionOptions; @@ -587,6 +588,7 @@ public void executeSqlTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -673,6 +675,7 @@ public void executeBatchDmlTest() throws Exception { ExecuteBatchDmlResponse.newBuilder() .addAllResultSets(new ArrayList()) .setStatus(Status.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -735,6 +738,7 @@ public void readTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -821,6 +825,7 @@ public void beginTransactionTest() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -868,6 +873,7 @@ public void beginTransactionTest2() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java index 22f578ac2bc..83caf7405d9 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/v1/SpannerClientTest.java @@ -55,6 +55,7 @@ import com.google.spanner.v1.KeySet; import com.google.spanner.v1.ListSessionsRequest; import com.google.spanner.v1.ListSessionsResponse; +import com.google.spanner.v1.MultiplexedSessionPrecommitToken; import com.google.spanner.v1.Mutation; import com.google.spanner.v1.PartialResultSet; import com.google.spanner.v1.Partition; @@ -545,6 +546,7 @@ public void executeSqlTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -629,6 +631,7 @@ public void executeStreamingSqlTest() throws Exception { .setChunkedValue(true) .setResumeToken(ByteString.EMPTY) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); ExecuteSqlRequest request = @@ -702,6 +705,7 @@ public void executeBatchDmlTest() throws Exception { ExecuteBatchDmlResponse.newBuilder() .addAllResultSets(new ArrayList()) .setStatus(Status.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -762,6 +766,7 @@ public void readTest() throws Exception { .setMetadata(ResultSetMetadata.newBuilder().build()) .addAllRows(new ArrayList()) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -847,6 +852,7 @@ public void streamingReadTest() throws Exception { .setChunkedValue(true) .setResumeToken(ByteString.EMPTY) .setStats(ResultSetStats.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); ReadRequest request = @@ -920,6 +926,7 @@ public void beginTransactionTest() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); @@ -962,6 +969,7 @@ public void beginTransactionTest2() throws Exception { Transaction.newBuilder() .setId(ByteString.EMPTY) .setReadTimestamp(Timestamp.newBuilder().build()) + .setPrecommitToken(MultiplexedSessionPrecommitToken.newBuilder().build()) .build(); mockSpanner.addResponse(expectedResponse); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java index c2b54d6ce94..1a564ec3f5e 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequest.java @@ -238,6 +238,68 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( : requestOptions_; } + public static final int MUTATION_KEY_FIELD_NUMBER = 4; + private com.google.spanner.v1.Mutation mutationKey_; + /** + * + * + *
+   * Required for read-write transactions on a multiplexed session that commit
+   * mutations but do not perform any reads or queries.
+   * Clients should randomly select one of the mutations from the
+   * mutation set and send it as a part of this request.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the mutationKey field is set. + */ + @java.lang.Override + public boolean hasMutationKey() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * Required for read-write transactions on a multiplexed session that commit
+   * mutations but do not perform any reads or queries.
+   * Clients should randomly select one of the mutations from the
+   * mutation set and send it as a part of this request.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The mutationKey. + */ + @java.lang.Override + public com.google.spanner.v1.Mutation getMutationKey() { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } + /** + * + * + *
+   * Required for read-write transactions on a multiplexed session that commit
+   * mutations but do not perform any reads or queries.
+   * Clients should randomly select one of the mutations from the
+   * mutation set and send it as a part of this request.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MutationOrBuilder getMutationKeyOrBuilder() { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -261,6 +323,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(3, getRequestOptions()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(4, getMutationKey()); + } getUnknownFields().writeTo(output); } @@ -279,6 +344,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getRequestOptions()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getMutationKey()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -304,6 +372,10 @@ public boolean equals(final java.lang.Object obj) { if (hasRequestOptions()) { if (!getRequestOptions().equals(other.getRequestOptions())) return false; } + if (hasMutationKey() != other.hasMutationKey()) return false; + if (hasMutationKey()) { + if (!getMutationKey().equals(other.getMutationKey())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -325,6 +397,10 @@ public int hashCode() { hash = (37 * hash) + REQUEST_OPTIONS_FIELD_NUMBER; hash = (53 * hash) + getRequestOptions().hashCode(); } + if (hasMutationKey()) { + hash = (37 * hash) + MUTATION_KEY_FIELD_NUMBER; + hash = (53 * hash) + getMutationKey().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -468,6 +544,7 @@ private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getOptionsFieldBuilder(); getRequestOptionsFieldBuilder(); + getMutationKeyFieldBuilder(); } } @@ -486,6 +563,11 @@ public Builder clear() { requestOptionsBuilder_.dispose(); requestOptionsBuilder_ = null; } + mutationKey_ = null; + if (mutationKeyBuilder_ != null) { + mutationKeyBuilder_.dispose(); + mutationKeyBuilder_ = null; + } return this; } @@ -535,6 +617,11 @@ private void buildPartial0(com.google.spanner.v1.BeginTransactionRequest result) requestOptionsBuilder_ == null ? requestOptions_ : requestOptionsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.mutationKey_ = + mutationKeyBuilder_ == null ? mutationKey_ : mutationKeyBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -594,6 +681,9 @@ public Builder mergeFrom(com.google.spanner.v1.BeginTransactionRequest other) { if (other.hasRequestOptions()) { mergeRequestOptions(other.getRequestOptions()); } + if (other.hasMutationKey()) { + mergeMutationKey(other.getMutationKey()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -638,6 +728,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000004; break; } // case 26 + case 34: + { + input.readMessage(getMutationKeyFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1197,6 +1293,227 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( return requestOptionsBuilder_; } + private com.google.spanner.v1.Mutation mutationKey_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.Mutation, + com.google.spanner.v1.Mutation.Builder, + com.google.spanner.v1.MutationOrBuilder> + mutationKeyBuilder_; + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the mutationKey field is set. + */ + public boolean hasMutationKey() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The mutationKey. + */ + public com.google.spanner.v1.Mutation getMutationKey() { + if (mutationKeyBuilder_ == null) { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } else { + return mutationKeyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMutationKey(com.google.spanner.v1.Mutation value) { + if (mutationKeyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + mutationKey_ = value; + } else { + mutationKeyBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setMutationKey(com.google.spanner.v1.Mutation.Builder builderForValue) { + if (mutationKeyBuilder_ == null) { + mutationKey_ = builderForValue.build(); + } else { + mutationKeyBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeMutationKey(com.google.spanner.v1.Mutation value) { + if (mutationKeyBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && mutationKey_ != null + && mutationKey_ != com.google.spanner.v1.Mutation.getDefaultInstance()) { + getMutationKeyBuilder().mergeFrom(value); + } else { + mutationKey_ = value; + } + } else { + mutationKeyBuilder_.mergeFrom(value); + } + if (mutationKey_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearMutationKey() { + bitField0_ = (bitField0_ & ~0x00000008); + mutationKey_ = null; + if (mutationKeyBuilder_ != null) { + mutationKeyBuilder_.dispose(); + mutationKeyBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.Mutation.Builder getMutationKeyBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getMutationKeyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MutationOrBuilder getMutationKeyOrBuilder() { + if (mutationKeyBuilder_ != null) { + return mutationKeyBuilder_.getMessageOrBuilder(); + } else { + return mutationKey_ == null + ? com.google.spanner.v1.Mutation.getDefaultInstance() + : mutationKey_; + } + } + /** + * + * + *
+     * Required for read-write transactions on a multiplexed session that commit
+     * mutations but do not perform any reads or queries.
+     * Clients should randomly select one of the mutations from the
+     * mutation set and send it as a part of this request.
+     * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.Mutation, + com.google.spanner.v1.Mutation.Builder, + com.google.spanner.v1.MutationOrBuilder> + getMutationKeyFieldBuilder() { + if (mutationKeyBuilder_ == null) { + mutationKeyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.Mutation, + com.google.spanner.v1.Mutation.Builder, + com.google.spanner.v1.MutationOrBuilder>( + getMutationKey(), getParentForChildren(), isClean()); + mutationKey_ = null; + } + return mutationKeyBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java index f42a87a9df1..ceb5120da18 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/BeginTransactionRequestOrBuilder.java @@ -140,4 +140,51 @@ public interface BeginTransactionRequestOrBuilder * .google.spanner.v1.RequestOptions request_options = 3; */ com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder(); + + /** + * + * + *
+   * Required for read-write transactions on a multiplexed session that commit
+   * mutations but do not perform any reads or queries.
+   * Clients should randomly select one of the mutations from the
+   * mutation set and send it as a part of this request.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the mutationKey field is set. + */ + boolean hasMutationKey(); + /** + * + * + *
+   * Required for read-write transactions on a multiplexed session that commit
+   * mutations but do not perform any reads or queries.
+   * Clients should randomly select one of the mutations from the
+   * mutation set and send it as a part of this request.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The mutationKey. + */ + com.google.spanner.v1.Mutation getMutationKey(); + /** + * + * + *
+   * Required for read-write transactions on a multiplexed session that commit
+   * mutations but do not perform any reads or queries.
+   * Clients should randomly select one of the mutations from the
+   * mutation set and send it as a part of this request.
+   * 
+ * + * .google.spanner.v1.Mutation mutation_key = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MutationOrBuilder getMutationKeyOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java index cd3f62a2438..d17d62d3da4 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequest.java @@ -495,6 +495,72 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( : requestOptions_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 9; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * If the read-write transaction was executed on a multiplexed session, the
+   * precommit token with the highest sequence number received
+   * in this transaction attempt, should be included here.
+   * Failing to do so will result in a FailedPrecondition error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * If the read-write transaction was executed on a multiplexed session, the
+   * precommit token with the highest sequence number received
+   * in this transaction attempt, should be included here.
+   * Failing to do so will result in a FailedPrecondition error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * If the read-write transaction was executed on a multiplexed session, the
+   * precommit token with the highest sequence number received
+   * in this transaction attempt, should be included here.
+   * Failing to do so will result in a FailedPrecondition error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -530,6 +596,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(8, getMaxCommitDelay()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(9, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -564,6 +633,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getMaxCommitDelay()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -590,6 +662,10 @@ public boolean equals(final java.lang.Object obj) { if (hasRequestOptions()) { if (!getRequestOptions().equals(other.getRequestOptions())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getTransactionCase().equals(other.getTransactionCase())) return false; switch (transactionCase_) { case 2: @@ -628,6 +704,10 @@ public int hashCode() { hash = (37 * hash) + REQUEST_OPTIONS_FIELD_NUMBER; hash = (53 * hash) + getRequestOptions().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } switch (transactionCase_) { case 2: hash = (37 * hash) + TRANSACTION_ID_FIELD_NUMBER; @@ -782,6 +862,7 @@ private void maybeForceBuilderInitialization() { getMutationsFieldBuilder(); getMaxCommitDelayFieldBuilder(); getRequestOptionsFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -811,6 +892,11 @@ public Builder clear() { requestOptionsBuilder_.dispose(); requestOptionsBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } transactionCase_ = 0; transaction_ = null; return this; @@ -879,6 +965,11 @@ private void buildPartial0(com.google.spanner.v1.CommitRequest result) { requestOptionsBuilder_ == null ? requestOptions_ : requestOptionsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000080) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -976,6 +1067,9 @@ public Builder mergeFrom(com.google.spanner.v1.CommitRequest other) { if (other.hasRequestOptions()) { mergeRequestOptions(other.getRequestOptions()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } switch (other.getTransactionCase()) { case TRANSACTION_ID: { @@ -1067,6 +1161,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000020; break; } // case 66 + case 74: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000080; + break; + } // case 74 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -2434,6 +2534,241 @@ public com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder( return requestOptionsBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000080) != 0); + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000080; + onChanged(); + return this; + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000080) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000080; + onChanged(); + } + return this; + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000080); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000080; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * If the read-write transaction was executed on a multiplexed session, the
+     * precommit token with the highest sequence number received
+     * in this transaction attempt, should be included here.
+     * Failing to do so will result in a FailedPrecondition error.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java index ed19e5568e0..6974bb845d4 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitRequestOrBuilder.java @@ -298,5 +298,55 @@ public interface CommitRequestOrBuilder */ com.google.spanner.v1.RequestOptionsOrBuilder getRequestOptionsOrBuilder(); + /** + * + * + *
+   * If the read-write transaction was executed on a multiplexed session, the
+   * precommit token with the highest sequence number received
+   * in this transaction attempt, should be included here.
+   * Failing to do so will result in a FailedPrecondition error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * If the read-write transaction was executed on a multiplexed session, the
+   * precommit token with the highest sequence number received
+   * in this transaction attempt, should be included here.
+   * Failing to do so will result in a FailedPrecondition error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * If the read-write transaction was executed on a multiplexed session, the
+   * precommit token with the highest sequence number received
+   * in this transaction attempt, should be included here.
+   * Failing to do so will result in a FailedPrecondition error.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 9 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); + com.google.spanner.v1.CommitRequest.TransactionCase getTransactionCase(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java index 05ae3b23bfc..f25539a148e 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponse.java @@ -631,6 +631,52 @@ public com.google.spanner.v1.CommitResponse.CommitStats getDefaultInstanceForTyp } private int bitField0_; + private int multiplexedSessionRetryCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object multiplexedSessionRetry_; + + public enum MultiplexedSessionRetryCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PRECOMMIT_TOKEN(4), + MULTIPLEXEDSESSIONRETRY_NOT_SET(0); + private final int value; + + private MultiplexedSessionRetryCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static MultiplexedSessionRetryCase valueOf(int value) { + return forNumber(value); + } + + public static MultiplexedSessionRetryCase forNumber(int value) { + switch (value) { + case 4: + return PRECOMMIT_TOKEN; + case 0: + return MULTIPLEXEDSESSIONRETRY_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public MultiplexedSessionRetryCase getMultiplexedSessionRetryCase() { + return MultiplexedSessionRetryCase.forNumber(multiplexedSessionRetryCase_); + } + public static final int COMMIT_TIMESTAMP_FIELD_NUMBER = 1; private com.google.protobuf.Timestamp commitTimestamp_; /** @@ -737,6 +783,61 @@ public com.google.spanner.v1.CommitResponse.CommitStatsOrBuilder getCommitStatsO : commitStats_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 4; + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return multiplexedSessionRetryCase_ == 4; + } + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -757,6 +858,10 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(2, getCommitStats()); } + if (multiplexedSessionRetryCase_ == 4) { + output.writeMessage( + 4, (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_); + } getUnknownFields().writeTo(output); } @@ -772,6 +877,11 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCommitStats()); } + if (multiplexedSessionRetryCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -795,6 +905,15 @@ public boolean equals(final java.lang.Object obj) { if (hasCommitStats()) { if (!getCommitStats().equals(other.getCommitStats())) return false; } + if (!getMultiplexedSessionRetryCase().equals(other.getMultiplexedSessionRetryCase())) + return false; + switch (multiplexedSessionRetryCase_) { + case 4: + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + break; + case 0: + default: + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -814,6 +933,14 @@ public int hashCode() { hash = (37 * hash) + COMMIT_STATS_FIELD_NUMBER; hash = (53 * hash) + getCommitStats().hashCode(); } + switch (multiplexedSessionRetryCase_) { + case 4: + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + break; + case 0: + default: + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -972,6 +1099,11 @@ public Builder clear() { commitStatsBuilder_.dispose(); commitStatsBuilder_ = null; } + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.clear(); + } + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; return this; } @@ -1001,6 +1133,7 @@ public com.google.spanner.v1.CommitResponse buildPartial() { if (bitField0_ != 0) { buildPartial0(result); } + buildPartialOneofs(result); onBuilt(); return result; } @@ -1021,6 +1154,14 @@ private void buildPartial0(com.google.spanner.v1.CommitResponse result) { result.bitField0_ |= to_bitField0_; } + private void buildPartialOneofs(com.google.spanner.v1.CommitResponse result) { + result.multiplexedSessionRetryCase_ = multiplexedSessionRetryCase_; + result.multiplexedSessionRetry_ = this.multiplexedSessionRetry_; + if (multiplexedSessionRetryCase_ == 4 && precommitTokenBuilder_ != null) { + result.multiplexedSessionRetry_ = precommitTokenBuilder_.build(); + } + } + @java.lang.Override public Builder clone() { return super.clone(); @@ -1072,6 +1213,17 @@ public Builder mergeFrom(com.google.spanner.v1.CommitResponse other) { if (other.hasCommitStats()) { mergeCommitStats(other.getCommitStats()); } + switch (other.getMultiplexedSessionRetryCase()) { + case PRECOMMIT_TOKEN: + { + mergePrecommitToken(other.getPrecommitToken()); + break; + } + case MULTIPLEXEDSESSIONRETRY_NOT_SET: + { + break; + } + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1110,6 +1262,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 34: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + multiplexedSessionRetryCase_ = 4; + break; + } // case 34 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1127,6 +1285,20 @@ public Builder mergeFrom( return this; } + private int multiplexedSessionRetryCase_ = 0; + private java.lang.Object multiplexedSessionRetry_; + + public MultiplexedSessionRetryCase getMultiplexedSessionRetryCase() { + return MultiplexedSessionRetryCase.forNumber(multiplexedSessionRetryCase_); + } + + public Builder clearMultiplexedSessionRetry() { + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; + onChanged(); + return this; + } + private int bitField0_; private com.google.protobuf.Timestamp commitTimestamp_; @@ -1519,6 +1691,230 @@ public com.google.spanner.v1.CommitResponse.CommitStatsOrBuilder getCommitStatsO return commitStatsBuilder_; } + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return multiplexedSessionRetryCase_ == 4; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } else { + if (multiplexedSessionRetryCase_ == 4) { + return precommitTokenBuilder_.getMessage(); + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + multiplexedSessionRetry_ = value; + onChanged(); + } else { + precommitTokenBuilder_.setMessage(value); + } + multiplexedSessionRetryCase_ = 4; + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + multiplexedSessionRetry_ = builderForValue.build(); + onChanged(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + multiplexedSessionRetryCase_ = 4; + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (multiplexedSessionRetryCase_ == 4 + && multiplexedSessionRetry_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + multiplexedSessionRetry_ = + com.google.spanner.v1.MultiplexedSessionPrecommitToken.newBuilder( + (com.google.spanner.v1.MultiplexedSessionPrecommitToken) + multiplexedSessionRetry_) + .mergeFrom(value) + .buildPartial(); + } else { + multiplexedSessionRetry_ = value; + } + onChanged(); + } else { + if (multiplexedSessionRetryCase_ == 4) { + precommitTokenBuilder_.mergeFrom(value); + } else { + precommitTokenBuilder_.setMessage(value); + } + } + multiplexedSessionRetryCase_ = 4; + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public Builder clearPrecommitToken() { + if (precommitTokenBuilder_ == null) { + if (multiplexedSessionRetryCase_ == 4) { + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; + onChanged(); + } + } else { + if (multiplexedSessionRetryCase_ == 4) { + multiplexedSessionRetryCase_ = 0; + multiplexedSessionRetry_ = null; + } + precommitTokenBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if ((multiplexedSessionRetryCase_ == 4) && (precommitTokenBuilder_ != null)) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + if (multiplexedSessionRetryCase_ == 4) { + return (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_; + } + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + } + /** + * + * + *
+     * If specified, transaction has not committed yet.
+     * Clients must retry the commit with the new precommit token.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + if (!(multiplexedSessionRetryCase_ == 4)) { + multiplexedSessionRetry_ = + com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + (com.google.spanner.v1.MultiplexedSessionPrecommitToken) multiplexedSessionRetry_, + getParentForChildren(), + isClean()); + multiplexedSessionRetry_ = null; + } + multiplexedSessionRetryCase_ = 4; + onChanged(); + return precommitTokenBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java index e21b58a3dfe..247605af06c 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseOrBuilder.java @@ -99,4 +99,44 @@ public interface CommitResponseOrBuilder * .google.spanner.v1.CommitResponse.CommitStats commit_stats = 2; */ com.google.spanner.v1.CommitResponse.CommitStatsOrBuilder getCommitStatsOrBuilder(); + + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * If specified, transaction has not committed yet.
+   * Clients must retry the commit with the new precommit token.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 4; + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); + + com.google.spanner.v1.CommitResponse.MultiplexedSessionRetryCase getMultiplexedSessionRetryCase(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java index 6a0c06b8018..292218c245b 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/CommitResponseProto.java @@ -47,22 +47,27 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { java.lang.String[] descriptorData = { "\n\'google/spanner/v1/commit_response.prot" + "o\022\021google.spanner.v1\032\037google/protobuf/ti" - + "mestamp.proto\"\262\001\n\016CommitResponse\0224\n\020comm" - + "it_timestamp\030\001 \001(\0132\032.google.protobuf.Tim" - + "estamp\022C\n\014commit_stats\030\002 \001(\0132-.google.sp" - + "anner.v1.CommitResponse.CommitStats\032%\n\013C" - + "ommitStats\022\026\n\016mutation_count\030\001 \001(\003B\266\001\n\025c" - + "om.google.spanner.v1B\023CommitResponseProt" - + "oP\001Z5cloud.google.com/go/spanner/apiv1/s" - + "pannerpb;spannerpb\252\002\027Google.Cloud.Spanne" - + "r.V1\312\002\027Google\\Cloud\\Spanner\\V1\352\002\032Google:" - + ":Cloud::Spanner::V1b\006proto3" + + "mestamp.proto\032#google/spanner/v1/transac" + + "tion.proto\"\235\002\n\016CommitResponse\0224\n\020commit_" + + "timestamp\030\001 \001(\0132\032.google.protobuf.Timest" + + "amp\022C\n\014commit_stats\030\002 \001(\0132-.google.spann" + + "er.v1.CommitResponse.CommitStats\022N\n\017prec" + + "ommit_token\030\004 \001(\01323.google.spanner.v1.Mu" + + "ltiplexedSessionPrecommitTokenH\000\032%\n\013Comm" + + "itStats\022\026\n\016mutation_count\030\001 \001(\003B\031\n\027Multi" + + "plexedSessionRetryB\266\001\n\025com.google.spanne" + + "r.v1B\023CommitResponseProtoP\001Z5cloud.googl" + + "e.com/go/spanner/apiv1/spannerpb;spanner" + + "pb\252\002\027Google.Cloud.Spanner.V1\312\002\027Google\\Cl" + + "oud\\Spanner\\V1\352\002\032Google::Cloud::Spanner:" + + ":V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.TimestampProto.getDescriptor(), + com.google.spanner.v1.TransactionProto.getDescriptor(), }); internal_static_google_spanner_v1_CommitResponse_descriptor = getDescriptor().getMessageTypes().get(0); @@ -70,7 +75,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_CommitResponse_descriptor, new java.lang.String[] { - "CommitTimestamp", "CommitStats", + "CommitTimestamp", "CommitStats", "PrecommitToken", "MultiplexedSessionRetry", }); internal_static_google_spanner_v1_CommitResponse_CommitStats_descriptor = internal_static_google_spanner_v1_CommitResponse_descriptor.getNestedTypes().get(0); @@ -81,6 +86,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "MutationCount", }); com.google.protobuf.TimestampProto.getDescriptor(); + com.google.spanner.v1.TransactionProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java index f60631a1097..9a818adecab 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponse.java @@ -254,6 +254,75 @@ public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { return status_ == null ? com.google.rpc.Status.getDefaultInstance() : status_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 3; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -274,6 +343,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(2, getStatus()); } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -289,6 +361,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStatus()); } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -310,6 +385,10 @@ public boolean equals(final java.lang.Object obj) { if (hasStatus()) { if (!getStatus().equals(other.getStatus())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -329,6 +408,10 @@ public int hashCode() { hash = (37 * hash) + STATUS_FIELD_NUMBER; hash = (53 * hash) + getStatus().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -501,6 +584,7 @@ private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getResultSetsFieldBuilder(); getStatusFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -520,6 +604,11 @@ public Builder clear() { statusBuilder_.dispose(); statusBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -574,6 +663,11 @@ private void buildPartial0(com.google.spanner.v1.ExecuteBatchDmlResponse result) result.status_ = statusBuilder_ == null ? status_ : statusBuilder_.build(); to_bitField0_ |= 0x00000001; } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000002; + } result.bitField0_ |= to_bitField0_; } @@ -652,6 +746,9 @@ public Builder mergeFrom(com.google.spanner.v1.ExecuteBatchDmlResponse other) { if (other.hasStatus()) { mergeStatus(other.getStatus()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -696,6 +793,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 26: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1392,6 +1495,250 @@ public com.google.rpc.StatusOrBuilder getStatusOrBuilder() { return statusBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000004); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java index cac2a088624..551359460c3 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ExecuteBatchDmlResponseOrBuilder.java @@ -152,4 +152,57 @@ public interface ExecuteBatchDmlResponseOrBuilder * .google.rpc.Status status = 2; */ com.google.rpc.StatusOrBuilder getStatusOrBuilder(); + + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitToken.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitToken.java new file mode 100644 index 00000000000..e3538ba992b --- /dev/null +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitToken.java @@ -0,0 +1,648 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/v1/transaction.proto + +// Protobuf Java Version: 3.25.3 +package com.google.spanner.v1; + +/** + * + * + *
+ * When a read-write transaction is executed on a multiplexed session,
+ * this precommit token is sent back to the client
+ * as a part of the [Transaction] message in the BeginTransaction response and
+ * also as a part of the [ResultSet] and [PartialResultSet] responses.
+ * 
+ * + * Protobuf type {@code google.spanner.v1.MultiplexedSessionPrecommitToken} + */ +public final class MultiplexedSessionPrecommitToken extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.spanner.v1.MultiplexedSessionPrecommitToken) + MultiplexedSessionPrecommitTokenOrBuilder { + private static final long serialVersionUID = 0L; + // Use MultiplexedSessionPrecommitToken.newBuilder() to construct. + private MultiplexedSessionPrecommitToken( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private MultiplexedSessionPrecommitToken() { + precommitToken_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new MultiplexedSessionPrecommitToken(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.class, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder.class); + } + + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 1; + private com.google.protobuf.ByteString precommitToken_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+   * Opaque precommit token.
+   * 
+ * + * bytes precommit_token = 1; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPrecommitToken() { + return precommitToken_; + } + + public static final int SEQ_NUM_FIELD_NUMBER = 2; + private int seqNum_ = 0; + /** + * + * + *
+   * An incrementing seq number is generated on every precommit token
+   * that is returned. Clients should remember the precommit token with the
+   * highest sequence number from the current transaction attempt.
+   * 
+ * + * int32 seq_num = 2; + * + * @return The seqNum. + */ + @java.lang.Override + public int getSeqNum() { + return seqNum_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!precommitToken_.isEmpty()) { + output.writeBytes(1, precommitToken_); + } + if (seqNum_ != 0) { + output.writeInt32(2, seqNum_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!precommitToken_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(1, precommitToken_); + } + if (seqNum_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, seqNum_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.spanner.v1.MultiplexedSessionPrecommitToken)) { + return super.equals(obj); + } + com.google.spanner.v1.MultiplexedSessionPrecommitToken other = + (com.google.spanner.v1.MultiplexedSessionPrecommitToken) obj; + + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + if (getSeqNum() != other.getSeqNum()) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + hash = (37 * hash) + SEQ_NUM_FIELD_NUMBER; + hash = (53 * hash) + getSeqNum(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.spanner.v1.MultiplexedSessionPrecommitToken prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * When a read-write transaction is executed on a multiplexed session,
+   * this precommit token is sent back to the client
+   * as a part of the [Transaction] message in the BeginTransaction response and
+   * also as a part of the [ResultSet] and [PartialResultSet] responses.
+   * 
+ * + * Protobuf type {@code google.spanner.v1.MultiplexedSessionPrecommitToken} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.spanner.v1.MultiplexedSessionPrecommitToken) + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.class, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder.class); + } + + // Construct using com.google.spanner.v1.MultiplexedSessionPrecommitToken.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + precommitToken_ = com.google.protobuf.ByteString.EMPTY; + seqNum_ = 0; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.spanner.v1.TransactionProto + .internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getDefaultInstanceForType() { + return com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance(); + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken build() { + com.google.spanner.v1.MultiplexedSessionPrecommitToken result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken buildPartial() { + com.google.spanner.v1.MultiplexedSessionPrecommitToken result = + new com.google.spanner.v1.MultiplexedSessionPrecommitToken(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.spanner.v1.MultiplexedSessionPrecommitToken result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.precommitToken_ = precommitToken_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.seqNum_ = seqNum_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.spanner.v1.MultiplexedSessionPrecommitToken) { + return mergeFrom((com.google.spanner.v1.MultiplexedSessionPrecommitToken) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.spanner.v1.MultiplexedSessionPrecommitToken other) { + if (other == com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) + return this; + if (other.getPrecommitToken() != com.google.protobuf.ByteString.EMPTY) { + setPrecommitToken(other.getPrecommitToken()); + } + if (other.getSeqNum() != 0) { + setSeqNum(other.getSeqNum()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + precommitToken_ = input.readBytes(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + seqNum_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.protobuf.ByteString precommitToken_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Opaque precommit token.
+     * 
+ * + * bytes precommit_token = 1; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPrecommitToken() { + return precommitToken_; + } + /** + * + * + *
+     * Opaque precommit token.
+     * 
+ * + * bytes precommit_token = 1; + * + * @param value The precommitToken to set. + * @return This builder for chaining. + */ + public Builder setPrecommitToken(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Opaque precommit token.
+     * 
+ * + * bytes precommit_token = 1; + * + * @return This builder for chaining. + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000001); + precommitToken_ = getDefaultInstance().getPrecommitToken(); + onChanged(); + return this; + } + + private int seqNum_; + /** + * + * + *
+     * An incrementing seq number is generated on every precommit token
+     * that is returned. Clients should remember the precommit token with the
+     * highest sequence number from the current transaction attempt.
+     * 
+ * + * int32 seq_num = 2; + * + * @return The seqNum. + */ + @java.lang.Override + public int getSeqNum() { + return seqNum_; + } + /** + * + * + *
+     * An incrementing seq number is generated on every precommit token
+     * that is returned. Clients should remember the precommit token with the
+     * highest sequence number from the current transaction attempt.
+     * 
+ * + * int32 seq_num = 2; + * + * @param value The seqNum to set. + * @return This builder for chaining. + */ + public Builder setSeqNum(int value) { + + seqNum_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * An incrementing seq number is generated on every precommit token
+     * that is returned. Clients should remember the precommit token with the
+     * highest sequence number from the current transaction attempt.
+     * 
+ * + * int32 seq_num = 2; + * + * @return This builder for chaining. + */ + public Builder clearSeqNum() { + bitField0_ = (bitField0_ & ~0x00000002); + seqNum_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.spanner.v1.MultiplexedSessionPrecommitToken) + } + + // @@protoc_insertion_point(class_scope:google.spanner.v1.MultiplexedSessionPrecommitToken) + private static final com.google.spanner.v1.MultiplexedSessionPrecommitToken DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.spanner.v1.MultiplexedSessionPrecommitToken(); + } + + public static com.google.spanner.v1.MultiplexedSessionPrecommitToken getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public MultiplexedSessionPrecommitToken parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitTokenOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitTokenOrBuilder.java new file mode 100644 index 00000000000..31caeab1b31 --- /dev/null +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/MultiplexedSessionPrecommitTokenOrBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/spanner/v1/transaction.proto + +// Protobuf Java Version: 3.25.3 +package com.google.spanner.v1; + +public interface MultiplexedSessionPrecommitTokenOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.spanner.v1.MultiplexedSessionPrecommitToken) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Opaque precommit token.
+   * 
+ * + * bytes precommit_token = 1; + * + * @return The precommitToken. + */ + com.google.protobuf.ByteString getPrecommitToken(); + + /** + * + * + *
+   * An incrementing seq number is generated on every precommit token
+   * that is returned. Clients should remember the precommit token with the
+   * highest sequence number from the current transaction attempt.
+   * 
+ * + * int32 seq_num = 2; + * + * @return The seqNum. + */ + int getSeqNum(); +} diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java index 9cd2a3dca19..403a61b5231 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSet.java @@ -653,6 +653,75 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return stats_ == null ? com.google.spanner.v1.ResultSetStats.getDefaultInstance() : stats_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 8; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -682,6 +751,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(5, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(8, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -706,6 +778,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -732,6 +807,10 @@ public boolean equals(final java.lang.Object obj) { if (hasStats()) { if (!getStats().equals(other.getStats())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -759,6 +838,10 @@ public int hashCode() { hash = (37 * hash) + STATS_FIELD_NUMBER; hash = (53 * hash) + getStats().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -904,6 +987,7 @@ private void maybeForceBuilderInitialization() { getMetadataFieldBuilder(); getValuesFieldBuilder(); getStatsFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -930,6 +1014,11 @@ public Builder clear() { statsBuilder_.dispose(); statsBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -994,6 +1083,11 @@ private void buildPartial0(com.google.spanner.v1.PartialResultSet result) { result.stats_ = statsBuilder_ == null ? stats_ : statsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000020) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -1081,6 +1175,9 @@ public Builder mergeFrom(com.google.spanner.v1.PartialResultSet other) { if (other.hasStats()) { mergeStats(other.getStats()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1143,6 +1240,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000010; break; } // case 42 + case 66: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000020; + break; + } // case 66 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -3346,6 +3449,250 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return statsBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000020) != 0); + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000020; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000020; + onChanged(); + } + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000020); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000020; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java index 2e743fd893e..d5f8aecc044 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/PartialResultSetOrBuilder.java @@ -554,4 +554,57 @@ public interface PartialResultSetOrBuilder * .google.spanner.v1.ResultSetStats stats = 5; */ com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder(); + + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 8 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java index 6140bf77e6e..9def6101bbc 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/spanner/v1/result_set.proto -// Protobuf Java Version: 3.25.4 +// Protobuf Java Version: 3.25.3 package com.google.spanner.v1; /** @@ -276,6 +276,75 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return stats_ == null ? com.google.spanner.v1.ResultSetStats.getDefaultInstance() : stats_; } + public static final int PRECOMMIT_TOKEN_FIELD_NUMBER = 5; + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -299,6 +368,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000002) != 0)) { output.writeMessage(3, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + output.writeMessage(5, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -317,6 +389,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000002) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getStats()); } + if (((bitField0_ & 0x00000004) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -341,6 +416,10 @@ public boolean equals(final java.lang.Object obj) { if (hasStats()) { if (!getStats().equals(other.getStats())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -364,6 +443,10 @@ public int hashCode() { hash = (37 * hash) + STATS_FIELD_NUMBER; hash = (53 * hash) + getStats().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -506,6 +589,7 @@ private void maybeForceBuilderInitialization() { getMetadataFieldBuilder(); getRowsFieldBuilder(); getStatsFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -530,6 +614,11 @@ public Builder clear() { statsBuilder_.dispose(); statsBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -587,6 +676,11 @@ private void buildPartial0(com.google.spanner.v1.ResultSet result) { result.stats_ = statsBuilder_ == null ? stats_ : statsBuilder_.build(); to_bitField0_ |= 0x00000002; } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000004; + } result.bitField0_ |= to_bitField0_; } @@ -668,6 +762,9 @@ public Builder mergeFrom(com.google.spanner.v1.ResultSet other) { if (other.hasStats()) { mergeStats(other.getStats()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -718,6 +815,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000004; break; } // case 26 + case 42: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 42 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1598,6 +1701,250 @@ public com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder() { return statsBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000008); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * A precommit token will be included if the read-write transaction
+     * is on a multiplexed session.
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the
+     * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+     * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java index 3342ed60322..7d8601247cd 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/spanner/v1/result_set.proto -// Protobuf Java Version: 3.25.4 +// Protobuf Java Version: 3.25.3 package com.google.spanner.v1; public interface ResultSetOrBuilder @@ -190,4 +190,57 @@ public interface ResultSetOrBuilder * .google.spanner.v1.ResultSetStats stats = 3; */ com.google.spanner.v1.ResultSetStatsOrBuilder getStatsOrBuilder(); + + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included if the read-write transaction
+   * is on a multiplexed session.
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the
+   * [Commit][google.spanner.v1.Spanner.Commit] request for this transaction.
+   * 
+ * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java index cab0e9c2c0d..a45bb97cd5f 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/ResultSetProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/spanner/v1/result_set.proto -// Protobuf Java Version: 3.25.4 +// Protobuf Java Version: 3.25.3 package com.google.spanner.v1; public final class ResultSetProto { @@ -55,39 +55,45 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { java.lang.String[] descriptorData = { "\n\"google/spanner/v1/result_set.proto\022\021go" + "ogle.spanner.v1\032\034google/protobuf/struct." - + "proto\032\"google/spanner/v1/query_plan.prot" - + "o\032#google/spanner/v1/transaction.proto\032\034" - + "google/spanner/v1/type.proto\"\237\001\n\tResultS" - + "et\0226\n\010metadata\030\001 \001(\0132$.google.spanner.v1" - + ".ResultSetMetadata\022(\n\004rows\030\002 \003(\0132\032.googl" - + "e.protobuf.ListValue\0220\n\005stats\030\003 \001(\0132!.go" - + "ogle.spanner.v1.ResultSetStats\"\321\001\n\020Parti" - + "alResultSet\0226\n\010metadata\030\001 \001(\0132$.google.s" - + "panner.v1.ResultSetMetadata\022&\n\006values\030\002 " - + "\003(\0132\026.google.protobuf.Value\022\025\n\rchunked_v" - + "alue\030\003 \001(\010\022\024\n\014resume_token\030\004 \001(\014\0220\n\005stat" - + "s\030\005 \001(\0132!.google.spanner.v1.ResultSetSta" - + "ts\"\267\001\n\021ResultSetMetadata\022/\n\010row_type\030\001 \001" - + "(\0132\035.google.spanner.v1.StructType\0223\n\013tra" - + "nsaction\030\002 \001(\0132\036.google.spanner.v1.Trans" - + "action\022<\n\025undeclared_parameters\030\003 \001(\0132\035." - + "google.spanner.v1.StructType\"\271\001\n\016ResultS" - + "etStats\0220\n\nquery_plan\030\001 \001(\0132\034.google.spa" - + "nner.v1.QueryPlan\022,\n\013query_stats\030\002 \001(\0132\027" - + ".google.protobuf.Struct\022\031\n\017row_count_exa" - + "ct\030\003 \001(\003H\000\022\037\n\025row_count_lower_bound\030\004 \001(" - + "\003H\000B\013\n\trow_countB\264\001\n\025com.google.spanner." - + "v1B\016ResultSetProtoP\001Z5cloud.google.com/g" - + "o/spanner/apiv1/spannerpb;spannerpb\370\001\001\252\002" - + "\027Google.Cloud.Spanner.V1\312\002\027Google\\Cloud\\" - + "Spanner\\V1\352\002\032Google::Cloud::Spanner::V1b" - + "\006proto3" + + "proto\032\037google/api/field_behavior.proto\032\"" + + "google/spanner/v1/query_plan.proto\032#goog" + + "le/spanner/v1/transaction.proto\032\034google/" + + "spanner/v1/type.proto\"\362\001\n\tResultSet\0226\n\010m" + + "etadata\030\001 \001(\0132$.google.spanner.v1.Result" + + "SetMetadata\022(\n\004rows\030\002 \003(\0132\032.google.proto" + + "buf.ListValue\0220\n\005stats\030\003 \001(\0132!.google.sp" + + "anner.v1.ResultSetStats\022Q\n\017precommit_tok" + + "en\030\005 \001(\01323.google.spanner.v1.Multiplexed" + + "SessionPrecommitTokenB\003\340A\001\"\244\002\n\020PartialRe" + + "sultSet\0226\n\010metadata\030\001 \001(\0132$.google.spann" + + "er.v1.ResultSetMetadata\022&\n\006values\030\002 \003(\0132" + + "\026.google.protobuf.Value\022\025\n\rchunked_value" + + "\030\003 \001(\010\022\024\n\014resume_token\030\004 \001(\014\0220\n\005stats\030\005 " + + "\001(\0132!.google.spanner.v1.ResultSetStats\022Q" + + "\n\017precommit_token\030\010 \001(\01323.google.spanner" + + ".v1.MultiplexedSessionPrecommitTokenB\003\340A" + + "\001\"\267\001\n\021ResultSetMetadata\022/\n\010row_type\030\001 \001(" + + "\0132\035.google.spanner.v1.StructType\0223\n\013tran" + + "saction\030\002 \001(\0132\036.google.spanner.v1.Transa" + + "ction\022<\n\025undeclared_parameters\030\003 \001(\0132\035.g" + + "oogle.spanner.v1.StructType\"\271\001\n\016ResultSe" + + "tStats\0220\n\nquery_plan\030\001 \001(\0132\034.google.span" + + "ner.v1.QueryPlan\022,\n\013query_stats\030\002 \001(\0132\027." + + "google.protobuf.Struct\022\031\n\017row_count_exac" + + "t\030\003 \001(\003H\000\022\037\n\025row_count_lower_bound\030\004 \001(\003" + + "H\000B\013\n\trow_countB\264\001\n\025com.google.spanner.v" + + "1B\016ResultSetProtoP\001Z5cloud.google.com/go" + + "/spanner/apiv1/spannerpb;spannerpb\370\001\001\252\002\027" + + "Google.Cloud.Spanner.V1\312\002\027Google\\Cloud\\S" + + "panner\\V1\352\002\032Google::Cloud::Spanner::V1b\006" + + "proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.StructProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), com.google.spanner.v1.QueryPlanProto.getDescriptor(), com.google.spanner.v1.TransactionProto.getDescriptor(), com.google.spanner.v1.TypeProto.getDescriptor(), @@ -98,7 +104,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_ResultSet_descriptor, new java.lang.String[] { - "Metadata", "Rows", "Stats", + "Metadata", "Rows", "Stats", "PrecommitToken", }); internal_static_google_spanner_v1_PartialResultSet_descriptor = getDescriptor().getMessageTypes().get(1); @@ -106,7 +112,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_PartialResultSet_descriptor, new java.lang.String[] { - "Metadata", "Values", "ChunkedValue", "ResumeToken", "Stats", + "Metadata", "Values", "ChunkedValue", "ResumeToken", "Stats", "PrecommitToken", }); internal_static_google_spanner_v1_ResultSetMetadata_descriptor = getDescriptor().getMessageTypes().get(2); @@ -124,7 +130,13 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "QueryPlan", "QueryStats", "RowCountExact", "RowCountLowerBound", "RowCount", }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); com.google.protobuf.StructProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); com.google.spanner.v1.QueryPlanProto.getDescriptor(); com.google.spanner.v1.TransactionProto.getDescriptor(); com.google.spanner.v1.TypeProto.getDescriptor(); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java index a2b7ea2625e..0badef8d708 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/spanner/v1/spanner.proto -// Protobuf Java Version: 3.25.4 +// Protobuf Java Version: 3.25.3 package com.google.spanner.v1; public final class SpannerProto { @@ -271,167 +271,172 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "(\0132C.google.spanner.v1.ExecuteBatchDmlRe" + "quest.Statement.ParamTypesEntry\032J\n\017Param" + "TypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005value\030\002 \001(\0132\027" - + ".google.spanner.v1.Type:\0028\001\"p\n\027ExecuteBa" - + "tchDmlResponse\0221\n\013result_sets\030\001 \003(\0132\034.go" - + "ogle.spanner.v1.ResultSet\022\"\n\006status\030\002 \001(" - + "\0132\022.google.rpc.Status\"H\n\020PartitionOption" - + "s\022\034\n\024partition_size_bytes\030\001 \001(\003\022\026\n\016max_p" - + "artitions\030\002 \001(\003\"\243\003\n\025PartitionQueryReques" - + "t\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spanner.goog" - + "leapis.com/Session\022;\n\013transaction\030\002 \001(\0132" - + "&.google.spanner.v1.TransactionSelector\022" - + "\020\n\003sql\030\003 \001(\tB\003\340A\002\022\'\n\006params\030\004 \001(\0132\027.goog" - + "le.protobuf.Struct\022M\n\013param_types\030\005 \003(\0132" - + "8.google.spanner.v1.PartitionQueryReques" - + "t.ParamTypesEntry\022>\n\021partition_options\030\006" - + " \001(\0132#.google.spanner.v1.PartitionOption" - + "s\032J\n\017ParamTypesEntry\022\013\n\003key\030\001 \001(\t\022&\n\005val" - + "ue\030\002 \001(\0132\027.google.spanner.v1.Type:\0028\001\"\261\002" - + "\n\024PartitionReadRequest\0227\n\007session\030\001 \001(\tB" - + "&\340A\002\372A \n\036spanner.googleapis.com/Session\022" - + ";\n\013transaction\030\002 \001(\0132&.google.spanner.v1" - + ".TransactionSelector\022\022\n\005table\030\003 \001(\tB\003\340A\002" - + "\022\r\n\005index\030\004 \001(\t\022\017\n\007columns\030\005 \003(\t\022/\n\007key_" - + "set\030\006 \001(\0132\031.google.spanner.v1.KeySetB\003\340A" - + "\002\022>\n\021partition_options\030\t \001(\0132#.google.sp" - + "anner.v1.PartitionOptions\"$\n\tPartition\022\027" - + "\n\017partition_token\030\001 \001(\014\"z\n\021PartitionResp" - + "onse\0220\n\npartitions\030\001 \003(\0132\034.google.spanne" - + "r.v1.Partition\0223\n\013transaction\030\002 \001(\0132\036.go" - + "ogle.spanner.v1.Transaction\"\366\005\n\013ReadRequ" - + "est\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spanner.go" - + "ogleapis.com/Session\022;\n\013transaction\030\002 \001(" - + "\0132&.google.spanner.v1.TransactionSelecto" - + "r\022\022\n\005table\030\003 \001(\tB\003\340A\002\022\r\n\005index\030\004 \001(\t\022\024\n\007" - + "columns\030\005 \003(\tB\003\340A\002\022/\n\007key_set\030\006 \001(\0132\031.go" - + "ogle.spanner.v1.KeySetB\003\340A\002\022\r\n\005limit\030\010 \001" - + "(\003\022\024\n\014resume_token\030\t \001(\014\022\027\n\017partition_to" - + "ken\030\n \001(\014\022:\n\017request_options\030\013 \001(\0132!.goo" - + "gle.spanner.v1.RequestOptions\022E\n\025directe" - + "d_read_options\030\016 \001(\0132&.google.spanner.v1" - + ".DirectedReadOptions\022\032\n\022data_boost_enabl" - + "ed\030\017 \001(\010\022=\n\010order_by\030\020 \001(\0162&.google.span" - + "ner.v1.ReadRequest.OrderByB\003\340A\001\022?\n\tlock_" - + "hint\030\021 \001(\0162\'.google.spanner.v1.ReadReque" - + "st.LockHintB\003\340A\001\"T\n\007OrderBy\022\030\n\024ORDER_BY_" - + "UNSPECIFIED\020\000\022\030\n\024ORDER_BY_PRIMARY_KEY\020\001\022" - + "\025\n\021ORDER_BY_NO_ORDER\020\002\"T\n\010LockHint\022\031\n\025LO" - + "CK_HINT_UNSPECIFIED\020\000\022\024\n\020LOCK_HINT_SHARE" - + "D\020\001\022\027\n\023LOCK_HINT_EXCLUSIVE\020\002\"\313\001\n\027BeginTr" - + "ansactionRequest\0227\n\007session\030\001 \001(\tB&\340A\002\372A" - + " \n\036spanner.googleapis.com/Session\022;\n\007opt" - + "ions\030\002 \001(\0132%.google.spanner.v1.Transacti" - + "onOptionsB\003\340A\002\022:\n\017request_options\030\003 \001(\0132" - + "!.google.spanner.v1.RequestOptions\"\375\002\n\rC" - + "ommitRequest\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036s" - + "panner.googleapis.com/Session\022\030\n\016transac" - + "tion_id\030\002 \001(\014H\000\022G\n\026single_use_transactio" - + "n\030\003 \001(\0132%.google.spanner.v1.TransactionO" - + "ptionsH\000\022.\n\tmutations\030\004 \003(\0132\033.google.spa" - + "nner.v1.Mutation\022\033\n\023return_commit_stats\030" - + "\005 \001(\010\0228\n\020max_commit_delay\030\010 \001(\0132\031.google" - + ".protobuf.DurationB\003\340A\001\022:\n\017request_optio" - + "ns\030\006 \001(\0132!.google.spanner.v1.RequestOpti" - + "onsB\r\n\013transaction\"g\n\017RollbackRequest\0227\n" - + "\007session\030\001 \001(\tB&\340A\002\372A \n\036spanner.googleap" - + "is.com/Session\022\033\n\016transaction_id\030\002 \001(\014B\003" - + "\340A\002\"\316\002\n\021BatchWriteRequest\0227\n\007session\030\001 \001" - + "(\tB&\340A\002\372A \n\036spanner.googleapis.com/Sessi" - + "on\022:\n\017request_options\030\003 \001(\0132!.google.spa" - + "nner.v1.RequestOptions\022P\n\017mutation_group" - + "s\030\004 \003(\01322.google.spanner.v1.BatchWriteRe" - + "quest.MutationGroupB\003\340A\002\022,\n\037exclude_txn_" - + "from_change_streams\030\005 \001(\010B\003\340A\001\032D\n\rMutati" - + "onGroup\0223\n\tmutations\030\001 \003(\0132\033.google.span" - + "ner.v1.MutationB\003\340A\002\"\177\n\022BatchWriteRespon" - + "se\022\017\n\007indexes\030\001 \003(\005\022\"\n\006status\030\002 \001(\0132\022.go" - + "ogle.rpc.Status\0224\n\020commit_timestamp\030\003 \001(" - + "\0132\032.google.protobuf.Timestamp2\213\030\n\007Spanne" - + "r\022\246\001\n\rCreateSession\022\'.google.spanner.v1." - + "CreateSessionRequest\032\032.google.spanner.v1" - + ".Session\"P\332A\010database\202\323\344\223\002?\":/v1/{databa" - + "se=projects/*/instances/*/databases/*}/s" - + "essions:\001*\022\340\001\n\023BatchCreateSessions\022-.goo" - + "gle.spanner.v1.BatchCreateSessionsReques" - + "t\032..google.spanner.v1.BatchCreateSession" - + "sResponse\"j\332A\026database,session_count\202\323\344\223" - + "\002K\"F/v1/{database=projects/*/instances/*" - + "/databases/*}/sessions:batchCreate:\001*\022\227\001" - + "\n\nGetSession\022$.google.spanner.v1.GetSess" - + "ionRequest\032\032.google.spanner.v1.Session\"G" - + "\332A\004name\202\323\344\223\002:\0228/v1/{name=projects/*/inst" - + "ances/*/databases/*/sessions/*}\022\256\001\n\014List" - + "Sessions\022&.google.spanner.v1.ListSession" - + "sRequest\032\'.google.spanner.v1.ListSession" - + "sResponse\"M\332A\010database\202\323\344\223\002<\022:/v1/{datab" - + "ase=projects/*/instances/*/databases/*}/" - + "sessions\022\231\001\n\rDeleteSession\022\'.google.span" - + "ner.v1.DeleteSessionRequest\032\026.google.pro" - + "tobuf.Empty\"G\332A\004name\202\323\344\223\002:*8/v1/{name=pr" - + "ojects/*/instances/*/databases/*/session" - + "s/*}\022\243\001\n\nExecuteSql\022$.google.spanner.v1." - + "ExecuteSqlRequest\032\034.google.spanner.v1.Re" - + "sultSet\"Q\202\323\344\223\002K\"F/v1/{session=projects/*" - + "/instances/*/databases/*/sessions/*}:exe" - + "cuteSql:\001*\022\276\001\n\023ExecuteStreamingSql\022$.goo" - + "gle.spanner.v1.ExecuteSqlRequest\032#.googl" - + "e.spanner.v1.PartialResultSet\"Z\202\323\344\223\002T\"O/" - + "v1/{session=projects/*/instances/*/datab" - + "ases/*/sessions/*}:executeStreamingSql:\001" - + "*0\001\022\300\001\n\017ExecuteBatchDml\022).google.spanner" - + ".v1.ExecuteBatchDmlRequest\032*.google.span" - + "ner.v1.ExecuteBatchDmlResponse\"V\202\323\344\223\002P\"K" + + ".google.spanner.v1.Type:\0028\001\"\303\001\n\027ExecuteB" + + "atchDmlResponse\0221\n\013result_sets\030\001 \003(\0132\034.g" + + "oogle.spanner.v1.ResultSet\022\"\n\006status\030\002 \001" + + "(\0132\022.google.rpc.Status\022Q\n\017precommit_toke" + + "n\030\003 \001(\01323.google.spanner.v1.MultiplexedS" + + "essionPrecommitTokenB\003\340A\001\"H\n\020PartitionOp" + + "tions\022\034\n\024partition_size_bytes\030\001 \001(\003\022\026\n\016m" + + "ax_partitions\030\002 \001(\003\"\243\003\n\025PartitionQueryRe" + + "quest\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spanner." + + "googleapis.com/Session\022;\n\013transaction\030\002 " + + "\001(\0132&.google.spanner.v1.TransactionSelec" + + "tor\022\020\n\003sql\030\003 \001(\tB\003\340A\002\022\'\n\006params\030\004 \001(\0132\027." + + "google.protobuf.Struct\022M\n\013param_types\030\005 " + + "\003(\01328.google.spanner.v1.PartitionQueryRe" + + "quest.ParamTypesEntry\022>\n\021partition_optio" + + "ns\030\006 \001(\0132#.google.spanner.v1.PartitionOp" + + "tions\032J\n\017ParamTypesEntry\022\013\n\003key\030\001 \001(\t\022&\n" + + "\005value\030\002 \001(\0132\027.google.spanner.v1.Type:\0028" + + "\001\"\261\002\n\024PartitionReadRequest\0227\n\007session\030\001 " + + "\001(\tB&\340A\002\372A \n\036spanner.googleapis.com/Sess" + + "ion\022;\n\013transaction\030\002 \001(\0132&.google.spanne" + + "r.v1.TransactionSelector\022\022\n\005table\030\003 \001(\tB" + + "\003\340A\002\022\r\n\005index\030\004 \001(\t\022\017\n\007columns\030\005 \003(\t\022/\n\007" + + "key_set\030\006 \001(\0132\031.google.spanner.v1.KeySet" + + "B\003\340A\002\022>\n\021partition_options\030\t \001(\0132#.googl" + + "e.spanner.v1.PartitionOptions\"$\n\tPartiti" + + "on\022\027\n\017partition_token\030\001 \001(\014\"z\n\021Partition" + + "Response\0220\n\npartitions\030\001 \003(\0132\034.google.sp" + + "anner.v1.Partition\0223\n\013transaction\030\002 \001(\0132" + + "\036.google.spanner.v1.Transaction\"\366\005\n\013Read" + + "Request\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spanne" + + "r.googleapis.com/Session\022;\n\013transaction\030" + + "\002 \001(\0132&.google.spanner.v1.TransactionSel" + + "ector\022\022\n\005table\030\003 \001(\tB\003\340A\002\022\r\n\005index\030\004 \001(\t" + + "\022\024\n\007columns\030\005 \003(\tB\003\340A\002\022/\n\007key_set\030\006 \001(\0132" + + "\031.google.spanner.v1.KeySetB\003\340A\002\022\r\n\005limit" + + "\030\010 \001(\003\022\024\n\014resume_token\030\t \001(\014\022\027\n\017partitio" + + "n_token\030\n \001(\014\022:\n\017request_options\030\013 \001(\0132!" + + ".google.spanner.v1.RequestOptions\022E\n\025dir" + + "ected_read_options\030\016 \001(\0132&.google.spanne" + + "r.v1.DirectedReadOptions\022\032\n\022data_boost_e" + + "nabled\030\017 \001(\010\022=\n\010order_by\030\020 \001(\0162&.google." + + "spanner.v1.ReadRequest.OrderByB\003\340A\001\022?\n\tl" + + "ock_hint\030\021 \001(\0162\'.google.spanner.v1.ReadR" + + "equest.LockHintB\003\340A\001\"T\n\007OrderBy\022\030\n\024ORDER" + + "_BY_UNSPECIFIED\020\000\022\030\n\024ORDER_BY_PRIMARY_KE" + + "Y\020\001\022\025\n\021ORDER_BY_NO_ORDER\020\002\"T\n\010LockHint\022\031" + + "\n\025LOCK_HINT_UNSPECIFIED\020\000\022\024\n\020LOCK_HINT_S" + + "HARED\020\001\022\027\n\023LOCK_HINT_EXCLUSIVE\020\002\"\203\002\n\027Beg" + + "inTransactionRequest\0227\n\007session\030\001 \001(\tB&\340" + + "A\002\372A \n\036spanner.googleapis.com/Session\022;\n" + + "\007options\030\002 \001(\0132%.google.spanner.v1.Trans" + + "actionOptionsB\003\340A\002\022:\n\017request_options\030\003 " + + "\001(\0132!.google.spanner.v1.RequestOptions\0226" + + "\n\014mutation_key\030\004 \001(\0132\033.google.spanner.v1" + + ".MutationB\003\340A\001\"\320\003\n\rCommitRequest\0227\n\007sess" + + "ion\030\001 \001(\tB&\340A\002\372A \n\036spanner.googleapis.co" + + "m/Session\022\030\n\016transaction_id\030\002 \001(\014H\000\022G\n\026s" + + "ingle_use_transaction\030\003 \001(\0132%.google.spa" + + "nner.v1.TransactionOptionsH\000\022.\n\tmutation" + + "s\030\004 \003(\0132\033.google.spanner.v1.Mutation\022\033\n\023" + + "return_commit_stats\030\005 \001(\010\0228\n\020max_commit_" + + "delay\030\010 \001(\0132\031.google.protobuf.DurationB\003" + + "\340A\001\022:\n\017request_options\030\006 \001(\0132!.google.sp" + + "anner.v1.RequestOptions\022Q\n\017precommit_tok" + + "en\030\t \001(\01323.google.spanner.v1.Multiplexed" + + "SessionPrecommitTokenB\003\340A\001B\r\n\013transactio" + + "n\"g\n\017RollbackRequest\0227\n\007session\030\001 \001(\tB&\340" + + "A\002\372A \n\036spanner.googleapis.com/Session\022\033\n" + + "\016transaction_id\030\002 \001(\014B\003\340A\002\"\316\002\n\021BatchWrit" + + "eRequest\0227\n\007session\030\001 \001(\tB&\340A\002\372A \n\036spann" + + "er.googleapis.com/Session\022:\n\017request_opt" + + "ions\030\003 \001(\0132!.google.spanner.v1.RequestOp" + + "tions\022P\n\017mutation_groups\030\004 \003(\01322.google." + + "spanner.v1.BatchWriteRequest.MutationGro" + + "upB\003\340A\002\022,\n\037exclude_txn_from_change_strea" + + "ms\030\005 \001(\010B\003\340A\001\032D\n\rMutationGroup\0223\n\tmutati" + + "ons\030\001 \003(\0132\033.google.spanner.v1.MutationB\003" + + "\340A\002\"\177\n\022BatchWriteResponse\022\017\n\007indexes\030\001 \003" + + "(\005\022\"\n\006status\030\002 \001(\0132\022.google.rpc.Status\0224" + + "\n\020commit_timestamp\030\003 \001(\0132\032.google.protob" + + "uf.Timestamp2\213\030\n\007Spanner\022\246\001\n\rCreateSessi" + + "on\022\'.google.spanner.v1.CreateSessionRequ" + + "est\032\032.google.spanner.v1.Session\"P\332A\010data" + + "base\202\323\344\223\002?\":/v1/{database=projects/*/ins" + + "tances/*/databases/*}/sessions:\001*\022\340\001\n\023Ba" + + "tchCreateSessions\022-.google.spanner.v1.Ba" + + "tchCreateSessionsRequest\032..google.spanne" + + "r.v1.BatchCreateSessionsResponse\"j\332A\026dat" + + "abase,session_count\202\323\344\223\002K\"F/v1/{database" + + "=projects/*/instances/*/databases/*}/ses" + + "sions:batchCreate:\001*\022\227\001\n\nGetSession\022$.go" + + "ogle.spanner.v1.GetSessionRequest\032\032.goog" + + "le.spanner.v1.Session\"G\332A\004name\202\323\344\223\002:\0228/v" + + "1/{name=projects/*/instances/*/databases" + + "/*/sessions/*}\022\256\001\n\014ListSessions\022&.google" + + ".spanner.v1.ListSessionsRequest\032\'.google" + + ".spanner.v1.ListSessionsResponse\"M\332A\010dat" + + "abase\202\323\344\223\002<\022:/v1/{database=projects/*/in" + + "stances/*/databases/*}/sessions\022\231\001\n\rDele" + + "teSession\022\'.google.spanner.v1.DeleteSess" + + "ionRequest\032\026.google.protobuf.Empty\"G\332A\004n" + + "ame\202\323\344\223\002:*8/v1/{name=projects/*/instance" + + "s/*/databases/*/sessions/*}\022\243\001\n\nExecuteS" + + "ql\022$.google.spanner.v1.ExecuteSqlRequest" + + "\032\034.google.spanner.v1.ResultSet\"Q\202\323\344\223\002K\"F" + "/v1/{session=projects/*/instances/*/data" - + "bases/*/sessions/*}:executeBatchDml:\001*\022\221" - + "\001\n\004Read\022\036.google.spanner.v1.ReadRequest\032" - + "\034.google.spanner.v1.ResultSet\"K\202\323\344\223\002E\"@/" - + "v1/{session=projects/*/instances/*/datab" - + "ases/*/sessions/*}:read:\001*\022\254\001\n\rStreaming" - + "Read\022\036.google.spanner.v1.ReadRequest\032#.g" - + "oogle.spanner.v1.PartialResultSet\"T\202\323\344\223\002" - + "N\"I/v1/{session=projects/*/instances/*/d" - + "atabases/*/sessions/*}:streamingRead:\001*0" - + "\001\022\311\001\n\020BeginTransaction\022*.google.spanner." - + "v1.BeginTransactionRequest\032\036.google.span" - + "ner.v1.Transaction\"i\332A\017session,options\202\323" - + "\344\223\002Q\"L/v1/{session=projects/*/instances/" - + "*/databases/*/sessions/*}:beginTransacti" - + "on:\001*\022\353\001\n\006Commit\022 .google.spanner.v1.Com" - + "mitRequest\032!.google.spanner.v1.CommitRes" - + "ponse\"\233\001\332A session,transaction_id,mutati" - + "ons\332A(session,single_use_transaction,mut" - + "ations\202\323\344\223\002G\"B/v1/{session=projects/*/in" - + "stances/*/databases/*/sessions/*}:commit" - + ":\001*\022\260\001\n\010Rollback\022\".google.spanner.v1.Rol" - + "lbackRequest\032\026.google.protobuf.Empty\"h\332A" - + "\026session,transaction_id\202\323\344\223\002I\"D/v1/{sess" - + "ion=projects/*/instances/*/databases/*/s" - + "essions/*}:rollback:\001*\022\267\001\n\016PartitionQuer" - + "y\022(.google.spanner.v1.PartitionQueryRequ" - + "est\032$.google.spanner.v1.PartitionRespons" - + "e\"U\202\323\344\223\002O\"J/v1/{session=projects/*/insta" - + "nces/*/databases/*/sessions/*}:partition" - + "Query:\001*\022\264\001\n\rPartitionRead\022\'.google.span" - + "ner.v1.PartitionReadRequest\032$.google.spa" - + "nner.v1.PartitionResponse\"T\202\323\344\223\002N\"I/v1/{" - + "session=projects/*/instances/*/databases" - + "/*/sessions/*}:partitionRead:\001*\022\310\001\n\nBatc" - + "hWrite\022$.google.spanner.v1.BatchWriteReq" - + "uest\032%.google.spanner.v1.BatchWriteRespo" - + "nse\"k\332A\027session,mutation_groups\202\323\344\223\002K\"F/" - + "v1/{session=projects/*/instances/*/datab" - + "ases/*/sessions/*}:batchWrite:\001*0\001\032w\312A\026s" - + "panner.googleapis.com\322A[https://www.goog" - + "leapis.com/auth/cloud-platform,https://w" - + "ww.googleapis.com/auth/spanner.dataB\221\002\n\025" - + "com.google.spanner.v1B\014SpannerProtoP\001Z5c" - + "loud.google.com/go/spanner/apiv1/spanner" - + "pb;spannerpb\252\002\027Google.Cloud.Spanner.V1\312\002" - + "\027Google\\Cloud\\Spanner\\V1\352\002\032Google::Cloud" - + "::Spanner::V1\352A_\n\037spanner.googleapis.com" - + "/Database\022 + * A precommit token will be included in the response of a BeginTransaction + * request if the read-write transaction is on a multiplexed session and + * a mutation_key was specified in the + * [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + * The precommit token with the highest sequence number from this transaction + * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + * request for this transaction. + * + * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return Whether the precommitToken field is set. + */ + @java.lang.Override + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return The precommitToken. + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + @java.lang.Override + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -174,6 +243,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io if (((bitField0_ & 0x00000001) != 0)) { output.writeMessage(2, getReadTimestamp()); } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getPrecommitToken()); + } getUnknownFields().writeTo(output); } @@ -189,6 +261,9 @@ public int getSerializedSize() { if (((bitField0_ & 0x00000001) != 0)) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getReadTimestamp()); } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPrecommitToken()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -209,6 +284,10 @@ public boolean equals(final java.lang.Object obj) { if (hasReadTimestamp()) { if (!getReadTimestamp().equals(other.getReadTimestamp())) return false; } + if (hasPrecommitToken() != other.hasPrecommitToken()) return false; + if (hasPrecommitToken()) { + if (!getPrecommitToken().equals(other.getPrecommitToken())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -226,6 +305,10 @@ public int hashCode() { hash = (37 * hash) + READ_TIMESTAMP_FIELD_NUMBER; hash = (53 * hash) + getReadTimestamp().hashCode(); } + if (hasPrecommitToken()) { + hash = (37 * hash) + PRECOMMIT_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPrecommitToken().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -366,6 +449,7 @@ private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { getReadTimestampFieldBuilder(); + getPrecommitTokenFieldBuilder(); } } @@ -379,6 +463,11 @@ public Builder clear() { readTimestampBuilder_.dispose(); readTimestampBuilder_ = null; } + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } return this; } @@ -423,6 +512,11 @@ private void buildPartial0(com.google.spanner.v1.Transaction result) { readTimestampBuilder_ == null ? readTimestamp_ : readTimestampBuilder_.build(); to_bitField0_ |= 0x00000001; } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.precommitToken_ = + precommitTokenBuilder_ == null ? precommitToken_ : precommitTokenBuilder_.build(); + to_bitField0_ |= 0x00000002; + } result.bitField0_ |= to_bitField0_; } @@ -477,6 +571,9 @@ public Builder mergeFrom(com.google.spanner.v1.Transaction other) { if (other.hasReadTimestamp()) { mergeReadTimestamp(other.getReadTimestamp()); } + if (other.hasPrecommitToken()) { + mergePrecommitToken(other.getPrecommitToken()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -515,6 +612,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000002; break; } // case 18 + case 26: + { + input.readMessage(getPrecommitTokenFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -840,6 +943,250 @@ public com.google.protobuf.TimestampOrBuilder getReadTimestampOrBuilder() { return readTimestampBuilder_; } + private com.google.spanner.v1.MultiplexedSessionPrecommitToken precommitToken_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + precommitTokenBuilder_; + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return Whether the precommitToken field is set. + */ + public boolean hasPrecommitToken() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return The precommitToken. + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken() { + if (precommitTokenBuilder_ == null) { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } else { + return precommitTokenBuilder_.getMessage(); + } + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder setPrecommitToken(com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + precommitToken_ = value; + } else { + precommitTokenBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder setPrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder builderForValue) { + if (precommitTokenBuilder_ == null) { + precommitToken_ = builderForValue.build(); + } else { + precommitTokenBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder mergePrecommitToken( + com.google.spanner.v1.MultiplexedSessionPrecommitToken value) { + if (precommitTokenBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && precommitToken_ != null + && precommitToken_ + != com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance()) { + getPrecommitTokenBuilder().mergeFrom(value); + } else { + precommitToken_ = value; + } + } else { + precommitTokenBuilder_.mergeFrom(value); + } + if (precommitToken_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public Builder clearPrecommitToken() { + bitField0_ = (bitField0_ & ~0x00000004); + precommitToken_ = null; + if (precommitTokenBuilder_ != null) { + precommitTokenBuilder_.dispose(); + precommitTokenBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder + getPrecommitTokenBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getPrecommitTokenFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + public com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder + getPrecommitTokenOrBuilder() { + if (precommitTokenBuilder_ != null) { + return precommitTokenBuilder_.getMessageOrBuilder(); + } else { + return precommitToken_ == null + ? com.google.spanner.v1.MultiplexedSessionPrecommitToken.getDefaultInstance() + : precommitToken_; + } + } + /** + * + * + *
+     * A precommit token will be included in the response of a BeginTransaction
+     * request if the read-write transaction is on a multiplexed session and
+     * a mutation_key was specified in the
+     * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+     * The precommit token with the highest sequence number from this transaction
+     * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+     * request for this transaction.
+     * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder> + getPrecommitTokenFieldBuilder() { + if (precommitTokenBuilder_ == null) { + precommitTokenBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.spanner.v1.MultiplexedSessionPrecommitToken, + com.google.spanner.v1.MultiplexedSessionPrecommitToken.Builder, + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder>( + getPrecommitToken(), getParentForChildren(), isClean()); + precommitToken_ = null; + } + return precommitTokenBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java index 60b3cdcc14a..f2acb127463 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/spanner/v1/transaction.proto -// Protobuf Java Version: 3.25.4 +// Protobuf Java Version: 3.25.3 package com.google.spanner.v1; /** @@ -413,6 +413,23 @@ public interface ReadWriteOrBuilder * @return The readLockMode. */ com.google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode getReadLockMode(); + + /** + * + * + *
+     * Clients should pass the transaction ID of the previous transaction
+     * attempt that was aborted if this transaction is being executed on a
+     * multiplexed session.
+     * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The multiplexedSessionPreviousTransactionId. + */ + com.google.protobuf.ByteString getMultiplexedSessionPreviousTransactionId(); } /** * @@ -436,6 +453,7 @@ private ReadWrite(com.google.protobuf.GeneratedMessageV3.Builder builder) { private ReadWrite() { readLockMode_ = 0; + multiplexedSessionPreviousTransactionId_ = com.google.protobuf.ByteString.EMPTY; } @java.lang.Override @@ -672,6 +690,29 @@ public com.google.spanner.v1.TransactionOptions.ReadWrite.ReadLockMode getReadLo : result; } + public static final int MULTIPLEXED_SESSION_PREVIOUS_TRANSACTION_ID_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString multiplexedSessionPreviousTransactionId_ = + com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * Clients should pass the transaction ID of the previous transaction
+     * attempt that was aborted if this transaction is being executed on a
+     * multiplexed session.
+     * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The multiplexedSessionPreviousTransactionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMultiplexedSessionPreviousTransactionId() { + return multiplexedSessionPreviousTransactionId_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -692,6 +733,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io .getNumber()) { output.writeEnum(1, readLockMode_); } + if (!multiplexedSessionPreviousTransactionId_.isEmpty()) { + output.writeBytes(2, multiplexedSessionPreviousTransactionId_); + } getUnknownFields().writeTo(output); } @@ -707,6 +751,11 @@ public int getSerializedSize() { .getNumber()) { size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, readLockMode_); } + if (!multiplexedSessionPreviousTransactionId_.isEmpty()) { + size += + com.google.protobuf.CodedOutputStream.computeBytesSize( + 2, multiplexedSessionPreviousTransactionId_); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -724,6 +773,8 @@ public boolean equals(final java.lang.Object obj) { (com.google.spanner.v1.TransactionOptions.ReadWrite) obj; if (readLockMode_ != other.readLockMode_) return false; + if (!getMultiplexedSessionPreviousTransactionId() + .equals(other.getMultiplexedSessionPreviousTransactionId())) return false; if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -737,6 +788,8 @@ public int hashCode() { hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + READ_LOCK_MODE_FIELD_NUMBER; hash = (53 * hash) + readLockMode_; + hash = (37 * hash) + MULTIPLEXED_SESSION_PREVIOUS_TRANSACTION_ID_FIELD_NUMBER; + hash = (53 * hash) + getMultiplexedSessionPreviousTransactionId().hashCode(); hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -880,6 +933,7 @@ public Builder clear() { super.clear(); bitField0_ = 0; readLockMode_ = 0; + multiplexedSessionPreviousTransactionId_ = com.google.protobuf.ByteString.EMPTY; return this; } @@ -919,6 +973,10 @@ private void buildPartial0(com.google.spanner.v1.TransactionOptions.ReadWrite re if (((from_bitField0_ & 0x00000001) != 0)) { result.readLockMode_ = readLockMode_; } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.multiplexedSessionPreviousTransactionId_ = + multiplexedSessionPreviousTransactionId_; + } } @java.lang.Override @@ -972,6 +1030,11 @@ public Builder mergeFrom(com.google.spanner.v1.TransactionOptions.ReadWrite othe if (other.readLockMode_ != 0) { setReadLockModeValue(other.getReadLockModeValue()); } + if (other.getMultiplexedSessionPreviousTransactionId() + != com.google.protobuf.ByteString.EMPTY) { + setMultiplexedSessionPreviousTransactionId( + other.getMultiplexedSessionPreviousTransactionId()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -1004,6 +1067,12 @@ public Builder mergeFrom( bitField0_ |= 0x00000001; break; } // case 8 + case 18: + { + multiplexedSessionPreviousTransactionId_ = input.readBytes(); + bitField0_ |= 0x00000002; + break; + } // case 18 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -1122,6 +1191,76 @@ public Builder clearReadLockMode() { return this; } + private com.google.protobuf.ByteString multiplexedSessionPreviousTransactionId_ = + com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+       * Clients should pass the transaction ID of the previous transaction
+       * attempt that was aborted if this transaction is being executed on a
+       * multiplexed session.
+       * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The multiplexedSessionPreviousTransactionId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getMultiplexedSessionPreviousTransactionId() { + return multiplexedSessionPreviousTransactionId_; + } + /** + * + * + *
+       * Clients should pass the transaction ID of the previous transaction
+       * attempt that was aborted if this transaction is being executed on a
+       * multiplexed session.
+       * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The multiplexedSessionPreviousTransactionId to set. + * @return This builder for chaining. + */ + public Builder setMultiplexedSessionPreviousTransactionId( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + multiplexedSessionPreviousTransactionId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Clients should pass the transaction ID of the previous transaction
+       * attempt that was aborted if this transaction is being executed on a
+       * multiplexed session.
+       * 
+ * + * + * bytes multiplexed_session_previous_transaction_id = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearMultiplexedSessionPreviousTransactionId() { + bitField0_ = (bitField0_ & ~0x00000002); + multiplexedSessionPreviousTransactionId_ = + getDefaultInstance().getMultiplexedSessionPreviousTransactionId(); + onChanged(); + return this; + } + @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java index 621c88aa4ca..5208eda515b 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionOrBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/spanner/v1/transaction.proto -// Protobuf Java Version: 3.25.4 +// Protobuf Java Version: 3.25.3 package com.google.spanner.v1; public interface TransactionOrBuilder @@ -93,4 +93,57 @@ public interface TransactionOrBuilder * .google.protobuf.Timestamp read_timestamp = 2; */ com.google.protobuf.TimestampOrBuilder getReadTimestampOrBuilder(); + + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return Whether the precommitToken field is set. + */ + boolean hasPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + * + * @return The precommitToken. + */ + com.google.spanner.v1.MultiplexedSessionPrecommitToken getPrecommitToken(); + /** + * + * + *
+   * A precommit token will be included in the response of a BeginTransaction
+   * request if the read-write transaction is on a multiplexed session and
+   * a mutation_key was specified in the
+   * [BeginTransaction][google.spanner.v1.BeginTransactionRequest].
+   * The precommit token with the highest sequence number from this transaction
+   * attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
+   * request for this transaction.
+   * 
+ * + * .google.spanner.v1.MultiplexedSessionPrecommitToken precommit_token = 3; + */ + com.google.spanner.v1.MultiplexedSessionPrecommitTokenOrBuilder getPrecommitTokenOrBuilder(); } diff --git a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java index 6c0a92fbd65..a6b036013e5 100644 --- a/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java +++ b/proto-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/TransactionProto.java @@ -1,5 +1,5 @@ /* - * Copyright 2024 Google LLC + * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/spanner/v1/transaction.proto -// Protobuf Java Version: 3.25.4 +// Protobuf Java Version: 3.25.3 package com.google.spanner.v1; public final class TransactionProto { @@ -52,6 +52,10 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_spanner_v1_TransactionSelector_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_spanner_v1_TransactionSelector_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; @@ -64,37 +68,43 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "\n#google/spanner/v1/transaction.proto\022\021g" + "oogle.spanner.v1\032\036google/protobuf/durati" + "on.proto\032\037google/protobuf/timestamp.prot" - + "o\"\224\006\n\022TransactionOptions\022E\n\nread_write\030\001" - + " \001(\0132/.google.spanner.v1.TransactionOpti" - + "ons.ReadWriteH\000\022O\n\017partitioned_dml\030\003 \001(\013" - + "24.google.spanner.v1.TransactionOptions." - + "PartitionedDmlH\000\022C\n\tread_only\030\002 \001(\0132..go" - + "ogle.spanner.v1.TransactionOptions.ReadO" - + "nlyH\000\022\'\n\037exclude_txn_from_change_streams" - + "\030\005 \001(\010\032\262\001\n\tReadWrite\022T\n\016read_lock_mode\030\001" - + " \001(\0162<.google.spanner.v1.TransactionOpti" - + "ons.ReadWrite.ReadLockMode\"O\n\014ReadLockMo" - + "de\022\036\n\032READ_LOCK_MODE_UNSPECIFIED\020\000\022\017\n\013PE" - + "SSIMISTIC\020\001\022\016\n\nOPTIMISTIC\020\002\032\020\n\016Partition" - + "edDml\032\250\002\n\010ReadOnly\022\020\n\006strong\030\001 \001(\010H\000\0228\n\022" - + "min_read_timestamp\030\002 \001(\0132\032.google.protob" - + "uf.TimestampH\000\0222\n\rmax_staleness\030\003 \001(\0132\031." - + "google.protobuf.DurationH\000\0224\n\016read_times" - + "tamp\030\004 \001(\0132\032.google.protobuf.TimestampH\000" - + "\0224\n\017exact_staleness\030\005 \001(\0132\031.google.proto" - + "buf.DurationH\000\022\035\n\025return_read_timestamp\030" - + "\006 \001(\010B\021\n\017timestamp_boundB\006\n\004mode\"M\n\013Tran" - + "saction\022\n\n\002id\030\001 \001(\014\0222\n\016read_timestamp\030\002 " - + "\001(\0132\032.google.protobuf.Timestamp\"\244\001\n\023Tran" - + "sactionSelector\022;\n\nsingle_use\030\001 \001(\0132%.go" - + "ogle.spanner.v1.TransactionOptionsH\000\022\014\n\002" - + "id\030\002 \001(\014H\000\0226\n\005begin\030\003 \001(\0132%.google.spann" - + "er.v1.TransactionOptionsH\000B\n\n\010selectorB\263" - + "\001\n\025com.google.spanner.v1B\020TransactionPro" - + "toP\001Z5cloud.google.com/go/spanner/apiv1/" - + "spannerpb;spannerpb\252\002\027Google.Cloud.Spann" - + "er.V1\312\002\027Google\\Cloud\\Spanner\\V1\352\002\032Google" - + "::Cloud::Spanner::V1b\006proto3" + + "o\032\037google/api/field_behavior.proto\"\316\006\n\022T" + + "ransactionOptions\022E\n\nread_write\030\001 \001(\0132/." + + "google.spanner.v1.TransactionOptions.Rea" + + "dWriteH\000\022O\n\017partitioned_dml\030\003 \001(\01324.goog" + + "le.spanner.v1.TransactionOptions.Partiti" + + "onedDmlH\000\022C\n\tread_only\030\002 \001(\0132..google.sp" + + "anner.v1.TransactionOptions.ReadOnlyH\000\022\'" + + "\n\037exclude_txn_from_change_streams\030\005 \001(\010\032" + + "\354\001\n\tReadWrite\022T\n\016read_lock_mode\030\001 \001(\0162<." + + "google.spanner.v1.TransactionOptions.Rea" + + "dWrite.ReadLockMode\0228\n+multiplexed_sessi" + + "on_previous_transaction_id\030\002 \001(\014B\003\340A\001\"O\n" + + "\014ReadLockMode\022\036\n\032READ_LOCK_MODE_UNSPECIF" + + "IED\020\000\022\017\n\013PESSIMISTIC\020\001\022\016\n\nOPTIMISTIC\020\002\032\020" + + "\n\016PartitionedDml\032\250\002\n\010ReadOnly\022\020\n\006strong\030" + + "\001 \001(\010H\000\0228\n\022min_read_timestamp\030\002 \001(\0132\032.go" + + "ogle.protobuf.TimestampH\000\0222\n\rmax_stalene" + + "ss\030\003 \001(\0132\031.google.protobuf.DurationH\000\0224\n" + + "\016read_timestamp\030\004 \001(\0132\032.google.protobuf." + + "TimestampH\000\0224\n\017exact_staleness\030\005 \001(\0132\031.g" + + "oogle.protobuf.DurationH\000\022\035\n\025return_read" + + "_timestamp\030\006 \001(\010B\021\n\017timestamp_boundB\006\n\004m" + + "ode\"\233\001\n\013Transaction\022\n\n\002id\030\001 \001(\014\0222\n\016read_" + + "timestamp\030\002 \001(\0132\032.google.protobuf.Timest" + + "amp\022L\n\017precommit_token\030\003 \001(\01323.google.sp" + + "anner.v1.MultiplexedSessionPrecommitToke" + + "n\"\244\001\n\023TransactionSelector\022;\n\nsingle_use\030" + + "\001 \001(\0132%.google.spanner.v1.TransactionOpt" + + "ionsH\000\022\014\n\002id\030\002 \001(\014H\000\0226\n\005begin\030\003 \001(\0132%.go" + + "ogle.spanner.v1.TransactionOptionsH\000B\n\n\010" + + "selector\"L\n MultiplexedSessionPrecommitT" + + "oken\022\027\n\017precommit_token\030\001 \001(\014\022\017\n\007seq_num" + + "\030\002 \001(\005B\263\001\n\025com.google.spanner.v1B\020Transa" + + "ctionProtoP\001Z5cloud.google.com/go/spanne" + + "r/apiv1/spannerpb;spannerpb\252\002\027Google.Clo" + + "ud.Spanner.V1\312\002\027Google\\Cloud\\Spanner\\V1\352" + + "\002\032Google::Cloud::Spanner::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -102,6 +112,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), }); internal_static_google_spanner_v1_TransactionOptions_descriptor = getDescriptor().getMessageTypes().get(0); @@ -117,7 +128,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_TransactionOptions_ReadWrite_descriptor, new java.lang.String[] { - "ReadLockMode", + "ReadLockMode", "MultiplexedSessionPreviousTransactionId", }); internal_static_google_spanner_v1_TransactionOptions_PartitionedDml_descriptor = internal_static_google_spanner_v1_TransactionOptions_descriptor.getNestedTypes().get(1); @@ -145,7 +156,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_spanner_v1_Transaction_descriptor, new java.lang.String[] { - "Id", "ReadTimestamp", + "Id", "ReadTimestamp", "PrecommitToken", }); internal_static_google_spanner_v1_TransactionSelector_descriptor = getDescriptor().getMessageTypes().get(2); @@ -155,8 +166,22 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "SingleUse", "Id", "Begin", "Selector", }); + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_spanner_v1_MultiplexedSessionPrecommitToken_descriptor, + new java.lang.String[] { + "PrecommitToken", "SeqNum", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto index d44aad63b61..9e29c9ce9e0 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/commit_response.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package google.spanner.v1; import "google/protobuf/timestamp.proto"; +import "google/spanner/v1/transaction.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb"; @@ -47,4 +48,13 @@ message CommitResponse { // For more information, see // [CommitRequest.return_commit_stats][google.spanner.v1.CommitRequest.return_commit_stats]. CommitStats commit_stats = 2; + + // Clients should examine and retry the commit if any of the following + // reasons are populated. + oneof MultiplexedSessionRetry { + // If specified, transaction has not committed yet. + // Clients must retry the commit with the new precommit token. + MultiplexedSessionPrecommitToken precommit_token = 4; + // (-- Room left for additional retry reasons in the future. --) + } } diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto index f392c1d7ddc..5c9b241bbff 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/result_set.proto @@ -17,6 +17,7 @@ syntax = "proto3"; package google.spanner.v1; import "google/protobuf/struct.proto"; +import "google/api/field_behavior.proto"; import "google/spanner/v1/query_plan.proto"; import "google/spanner/v1/transaction.proto"; import "google/spanner/v1/type.proto"; @@ -53,6 +54,15 @@ message ResultSet { // Other fields may or may not be populated, based on the // [ExecuteSqlRequest.query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode]. ResultSetStats stats = 3; + + // A precommit token will be included if the read-write transaction + // is on a multiplexed session. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the + // [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + MultiplexedSessionPrecommitToken precommit_token = 5 [ + (google.api.field_behavior) = OPTIONAL + ]; } // Partial results from a streaming read or SQL query. Streaming reads and @@ -157,6 +167,15 @@ message PartialResultSet { // This field will also be present in the last response for DML // statements. ResultSetStats stats = 5; + + // A precommit token will be included if the read-write transaction + // is on a multiplexed session. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the + // [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + MultiplexedSessionPrecommitToken precommit_token = 8 [ + (google.api.field_behavior) = OPTIONAL + ]; } // Metadata about a [ResultSet][google.spanner.v1.ResultSet] or [PartialResultSet][google.spanner.v1.PartialResultSet]. diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto index 301139210ed..8720c9849f7 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/spanner.proto @@ -899,6 +899,15 @@ message ExecuteBatchDmlResponse { // If all DML statements are executed successfully, the status is `OK`. // Otherwise, the error status of the first failed statement. google.rpc.Status status = 2; + + // A precommit token will be included if the read-write transaction + // is on a multiplexed session. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the + // [Commit][google.spanner.v1.Spanner.Commit] request for this transaction. + MultiplexedSessionPrecommitToken precommit_token = 3 [ + (google.api.field_behavior) = OPTIONAL + ]; } // Options for a PartitionQueryRequest and @@ -1215,6 +1224,14 @@ message BeginTransactionRequest { // transaction, set it on the reads and writes that are part of this // transaction instead. RequestOptions request_options = 3; + + // Required for read-write transactions on a multiplexed session that commit + // mutations but do not perform any reads or queries. + // Clients should randomly select one of the mutations from the + // mutation set and send it as a part of this request. + Mutation mutation_key = 4 [ + (google.api.field_behavior) = OPTIONAL + ]; } // The request for [Commit][google.spanner.v1.Spanner.Commit]. @@ -1262,6 +1279,14 @@ message CommitRequest { // Common options for this request. RequestOptions request_options = 6; + + // If the read-write transaction was executed on a multiplexed session, the + // precommit token with the highest sequence number received + // in this transaction attempt, should be included here. + // Failing to do so will result in a FailedPrecondition error. + MultiplexedSessionPrecommitToken precommit_token = 9 [ + (google.api.field_behavior) = OPTIONAL + ]; } // The request for [Rollback][google.spanner.v1.Spanner.Rollback]. diff --git a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto index 8af513d1563..0c1177c5995 100644 --- a/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto +++ b/proto-google-cloud-spanner-v1/src/main/proto/google/spanner/v1/transaction.proto @@ -18,6 +18,7 @@ package google.spanner.v1; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; +import "google/api/field_behavior.proto"; option csharp_namespace = "Google.Cloud.Spanner.V1"; option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb"; @@ -378,6 +379,13 @@ message TransactionOptions { // Read lock mode for the transaction. ReadLockMode read_lock_mode = 1; + + // Clients should pass the transaction ID of the previous transaction + // attempt that was aborted if this transaction is being executed on a + // multiplexed session. + bytes multiplexed_session_previous_transaction_id = 2 [ + (google.api.field_behavior) = OPTIONAL + ]; } // Message type to initiate a Partitioned DML transaction. @@ -512,6 +520,15 @@ message Transaction { // A timestamp in RFC3339 UTC \"Zulu\" format, accurate to nanoseconds. // Example: `"2014-10-02T15:01:23.045123456Z"`. google.protobuf.Timestamp read_timestamp = 2; + + // A precommit token will be included in the response of a BeginTransaction + // request if the read-write transaction is on a multiplexed session and + // a mutation_key was specified in the + // [BeginTransaction][google.spanner.v1.BeginTransactionRequest]. + // The precommit token with the highest sequence number from this transaction + // attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit] + // request for this transaction. + MultiplexedSessionPrecommitToken precommit_token = 3; } // This message is used to select the transaction in which a @@ -539,3 +556,16 @@ message TransactionSelector { TransactionOptions begin = 3; } } + +// When a read-write transaction is executed on a multiplexed session, +// this precommit token is sent back to the client +// as a part of the [Transaction] message in the BeginTransaction response and +// also as a part of the [ResultSet] and [PartialResultSet] responses. +message MultiplexedSessionPrecommitToken { + // Opaque precommit token. + bytes precommit_token = 1; + // An incrementing seq number is generated on every precommit token + // that is returned. Clients should remember the precommit token with the + // highest sequence number from the current transaction attempt. + int32 seq_num = 2; +}