diff --git a/google-cloud-spanner-executor/clirr-ignored-differences.xml b/google-cloud-spanner-executor/clirr-ignored-differences.xml index 9d3c127bcc..11e9890f1d 100644 --- a/google-cloud-spanner-executor/clirr-ignored-differences.xml +++ b/google-cloud-spanner-executor/clirr-ignored-differences.xml @@ -7,4 +7,9 @@ CloudExecutorImpl(boolean) CloudExecutorImpl(boolean, double) + + 7002 + com/google/cloud/spanner/SessionPoolOptionsHelper + com.google.cloud.spanner.SessionPoolOptions$Builder setUseMultiplexedSessionBlindWrite(com.google.cloud.spanner.SessionPoolOptions$Builder, boolean) + diff --git a/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java b/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java index c82b6306eb..d3f5712646 100644 --- a/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java +++ b/google-cloud-spanner-executor/src/main/java/com/google/cloud/executor/spanner/CloudClientExecutor.java @@ -830,8 +830,6 @@ private synchronized Spanner getClient(long timeoutSeconds, boolean useMultiplex com.google.cloud.spanner.SessionPoolOptions.Builder poolOptionsBuilder = com.google.cloud.spanner.SessionPoolOptions.newBuilder(); SessionPoolOptionsHelper.setUseMultiplexedSession(poolOptionsBuilder, useMultiplexedSession); - SessionPoolOptionsHelper.setUseMultiplexedSessionBlindWrite( - poolOptionsBuilder, useMultiplexedSession); SessionPoolOptionsHelper.setUseMultiplexedSessionForRW( poolOptionsBuilder, useMultiplexedSession); LOGGER.log( diff --git a/google-cloud-spanner-executor/src/main/java/com/google/cloud/spanner/SessionPoolOptionsHelper.java b/google-cloud-spanner-executor/src/main/java/com/google/cloud/spanner/SessionPoolOptionsHelper.java index f19cb8f4a2..9dd8ac2956 100644 --- a/google-cloud-spanner-executor/src/main/java/com/google/cloud/spanner/SessionPoolOptionsHelper.java +++ b/google-cloud-spanner-executor/src/main/java/com/google/cloud/spanner/SessionPoolOptionsHelper.java @@ -31,14 +31,6 @@ public static SessionPoolOptions.Builder setUseMultiplexedSession( return sessionPoolOptionsBuilder.setUseMultiplexedSession(useMultiplexedSession); } - // TODO: Remove when multiplexed session for blind write is released. - public static SessionPoolOptions.Builder setUseMultiplexedSessionBlindWrite( - SessionPoolOptions.Builder sessionPoolOptionsBuilder, - boolean useMultiplexedSessionBlindWrite) { - return sessionPoolOptionsBuilder.setUseMultiplexedSessionBlindWrite( - useMultiplexedSessionBlindWrite); - } - // TODO: Remove when multiplexed session for read write is released. public static SessionPoolOptions.Builder setUseMultiplexedSessionForRW( SessionPoolOptions.Builder sessionPoolOptionsBuilder, boolean useMultiplexedSessionForRW) { diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java index a691f14817..36a4e5fe20 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java @@ -77,12 +77,6 @@ public class SessionPoolOptions { private final boolean useMultiplexedSession; - /** - * Controls whether multiplexed session is enabled for blind write or not. This is only used for - * systest soak. TODO: Remove when multiplexed session for blind write is released. - */ - private final boolean useMultiplexedSessionBlindWrite; - private final boolean useMultiplexedSessionForRW; private final boolean useMultiplexedSessionForPartitionedOps; @@ -122,7 +116,6 @@ private SessionPoolOptions(Builder builder) { (useMultiplexedSessionFromEnvVariable != null) ? useMultiplexedSessionFromEnvVariable : builder.useMultiplexedSession; - this.useMultiplexedSessionBlindWrite = builder.useMultiplexedSessionBlindWrite; // useMultiplexedSessionForRW priority => Environment var > private setter > client default Boolean useMultiplexedSessionForRWFromEnvVariable = getUseMultiplexedSessionForRWFromEnvVariable(); @@ -205,7 +198,6 @@ public int hashCode() { this.inactiveTransactionRemovalOptions, this.poolMaintainerClock, this.useMultiplexedSession, - this.useMultiplexedSessionBlindWrite, this.useMultiplexedSessionForRW, this.multiplexedSessionMaintenanceDuration); } @@ -349,7 +341,7 @@ public boolean getUseMultiplexedSession() { @VisibleForTesting @InternalApi protected boolean getUseMultiplexedSessionBlindWrite() { - return getUseMultiplexedSession() && useMultiplexedSessionBlindWrite; + return getUseMultiplexedSession(); } @VisibleForTesting @@ -601,9 +593,6 @@ public static class Builder { // Set useMultiplexedSession to true to make multiplexed session the default. private boolean useMultiplexedSession = false; - // TODO: Remove when multiplexed session for blind write is released. - private boolean useMultiplexedSessionBlindWrite = false; - // This field controls the default behavior of session management for RW operations in Java // client. // Set useMultiplexedSessionForRW to true to make multiplexed session for RW operations the @@ -657,7 +646,6 @@ private Builder(SessionPoolOptions options) { this.randomizePositionQPSThreshold = options.randomizePositionQPSThreshold; this.inactiveTransactionRemovalOptions = options.inactiveTransactionRemovalOptions; this.useMultiplexedSession = options.useMultiplexedSession; - this.useMultiplexedSessionBlindWrite = options.useMultiplexedSessionBlindWrite; this.useMultiplexedSessionForRW = options.useMultiplexedSessionForRW; this.useMultiplexedSessionPartitionedOps = options.useMultiplexedSessionForPartitionedOps; this.multiplexedSessionMaintenanceDuration = options.multiplexedSessionMaintenanceDuration; @@ -857,17 +845,6 @@ Builder setUseMultiplexedSession(boolean useMultiplexedSession) { return this; } - /** - * This method enables multiplexed sessions for blind writes. This method will be removed in the - * future when multiplexed sessions has been made the default for all operations. - */ - @InternalApi - @VisibleForTesting - Builder setUseMultiplexedSessionBlindWrite(boolean useMultiplexedSessionBlindWrite) { - this.useMultiplexedSessionBlindWrite = useMultiplexedSessionBlindWrite; - return this; - } - /** * Sets whether the client should use multiplexed session for R/W operations or not. This method * is intentionally package-private and intended for internal use. diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java index 3121b868b8..c808bbe111 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/MultiplexedSessionDatabaseClientMockServerTest.java @@ -93,7 +93,6 @@ public void createSpannerInstance() { .setSessionPoolOption( SessionPoolOptions.newBuilder() .setUseMultiplexedSession(true) - .setUseMultiplexedSessionBlindWrite(true) .setUseMultiplexedSessionForRW(true) .setUseMultiplexedSessionPartitionedOps(true) // Set the maintainer to loop once every 1ms diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java index 3032a1cae4..a6c3f9fa7c 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/RetryOnInvalidatedSessionTest.java @@ -1288,6 +1288,9 @@ public void write() throws InterruptedException { @Test public void writeAtLeastOnce() throws InterruptedException { + assumeFalse( + "Multiplexed session do not throw a SessionNotFound errors. ", + spanner.getOptions().getSessionPoolOptions().getUseMultiplexedSession()); assertThrowsSessionNotFoundIfShouldFail( () -> client.writeAtLeastOnce(