@@ -91,7 +91,10 @@ public boolean doCreateDefaultTestTable() {
9191 @ Before
9292 public void clearTable () {
9393 try (ITConnection connection = createConnection ()) {
94+ connection .execute (Statement .of ("SELECT 1" ));
95+ connection .commit ();
9496 connection .bufferedWrite (Mutation .delete ("TEST" , KeySet .all ()));
97+ //connection.executeUpdate(Statement.of("DELETE FROM TEST WHERE TRUE"));
9598 get (connection .commitAsync ());
9699 }
97100 }
@@ -221,6 +224,7 @@ public void testCommitAborted() {
221224 AbortInterceptor interceptor = new AbortInterceptor (0 );
222225 try (ITConnection connection =
223226 createConnection (interceptor , new CountTransactionRetryListener ())) {
227+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
224228 ApiFuture <Long > count = getTestRecordCountAsync (connection );
225229 // do an insert
226230 ApiFuture <Long > updateCount =
@@ -253,6 +257,7 @@ public void testInsertAborted() {
253257 AbortInterceptor interceptor = new AbortInterceptor (0 );
254258 try (ITConnection connection =
255259 createConnection (interceptor , new CountTransactionRetryListener ())) {
260+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
256261 ApiFuture <Long > count = getTestRecordCountAsync (connection );
257262 // indicate that the next statement should abort
258263 interceptor .setProbability (1.0 );
@@ -276,6 +281,7 @@ public void testUpdateAborted() {
276281 AbortInterceptor interceptor = new AbortInterceptor (0 );
277282 try (ITConnection connection =
278283 createConnection (interceptor , new CountTransactionRetryListener ())) {
284+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
279285 ApiFuture <Long > count = getTestRecordCountAsync (connection );
280286 // insert a test record
281287 connection .executeUpdateAsync (
@@ -309,6 +315,7 @@ public void testQueryAborted() {
309315 AbortInterceptor interceptor = new AbortInterceptor (0 );
310316 try (ITConnection connection =
311317 createConnection (interceptor , new CountTransactionRetryListener ())) {
318+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
312319 // insert a test record
313320 connection .executeUpdateAsync (
314321 Statement .of ("INSERT INTO TEST (ID, NAME) VALUES (1, 'test aborted')" ));
@@ -359,6 +366,7 @@ public void testNextCallAborted() {
359366 AbortInterceptor interceptor = new AbortInterceptor (0 );
360367 try (ITConnection connection =
361368 createConnection (interceptor , new CountTransactionRetryListener ())) {
369+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
362370 // insert two test records
363371 connection .executeUpdateAsync (
364372 Statement .of ("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')" ));
@@ -392,6 +400,7 @@ public void testMultipleAborts() {
392400 AbortInterceptor interceptor = new AbortInterceptor (0 );
393401 try (ITConnection connection =
394402 createConnection (interceptor , new CountTransactionRetryListener ())) {
403+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
395404 ApiFuture <Long > count = getTestRecordCountAsync (connection );
396405 // do three inserts which all will abort and retry
397406 interceptor .setProbability (1.0 );
@@ -428,6 +437,7 @@ public void testAbortAfterSelect() {
428437 AbortInterceptor interceptor = new AbortInterceptor (0 );
429438 try (ITConnection connection =
430439 createConnection (interceptor , new CountTransactionRetryListener ())) {
440+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
431441 ApiFuture <Long > count = getTestRecordCountAsync (connection );
432442 // insert a test record
433443 connection .executeUpdateAsync (
@@ -504,6 +514,7 @@ public void testAbortWithResultSetHalfway() {
504514 AbortInterceptor interceptor = new AbortInterceptor (0 );
505515 try (ITConnection connection =
506516 createConnection (interceptor , new CountTransactionRetryListener ())) {
517+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
507518 // insert two test records
508519 connection .executeUpdateAsync (
509520 Statement .of ("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')" ));
@@ -539,6 +550,7 @@ public void testAbortWithResultSetFullyConsumed() {
539550 AbortInterceptor interceptor = new AbortInterceptor (0 );
540551 try (ITConnection connection =
541552 createConnection (interceptor , new CountTransactionRetryListener ())) {
553+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
542554 // insert two test records
543555 connection .executeUpdateAsync (
544556 Statement .of ("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')" ));
@@ -581,6 +593,7 @@ public void testAbortWithConcurrentInsert() {
581593 AbortInterceptor interceptor = new AbortInterceptor (0 );
582594 try (ITConnection connection =
583595 createConnection (interceptor , new CountTransactionRetryListener ())) {
596+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
584597 // insert two test records
585598 connection .executeUpdateAsync (
586599 Statement .of ("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')" ));
@@ -632,6 +645,7 @@ public void testAbortWithConcurrentDelete() {
632645 AbortInterceptor interceptor = new AbortInterceptor (0 );
633646 // first insert two test records
634647 try (ITConnection connection = createConnection ()) {
648+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
635649 connection .executeUpdateAsync (
636650 Statement .of ("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')" ));
637651 connection .executeUpdateAsync (
@@ -641,6 +655,7 @@ public void testAbortWithConcurrentDelete() {
641655 // open a new connection and select the two test records
642656 try (ITConnection connection =
643657 createConnection (interceptor , new CountTransactionRetryListener ())) {
658+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
644659 // select the test records and consume the entire result set
645660 try (AsyncResultSet rs =
646661 connection .executeQueryAsync (Statement .of ("SELECT * FROM TEST ORDER BY ID" ))) {
@@ -694,6 +709,7 @@ public void testAbortWithConcurrentUpdate() {
694709 // open a new connection and select the two test records
695710 try (ITConnection connection =
696711 createConnection (interceptor , new CountTransactionRetryListener ())) {
712+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
697713 // select the test records and consume the entire result set
698714 try (AsyncResultSet rs =
699715 connection .executeQueryAsync (Statement .of ("SELECT * FROM TEST ORDER BY ID" ))) {
@@ -744,6 +760,7 @@ public void testAbortWithUnseenConcurrentInsert() throws InterruptedException {
744760 AbortInterceptor interceptor = new AbortInterceptor (0 );
745761 try (ITConnection connection =
746762 createConnection (interceptor , new CountTransactionRetryListener ())) {
763+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
747764 // insert three test records
748765 connection .executeUpdateAsync (
749766 Statement .of ("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')" ));
@@ -833,6 +850,7 @@ public void testRetryLargeResultSet() {
833850 final long UPDATED_RECORDS = 1000L ;
834851 AbortInterceptor interceptor = new AbortInterceptor (0 );
835852 try (ITConnection connection = createConnection ()) {
853+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
836854 // insert test records
837855 for (int i = 0 ; i < NUMBER_OF_TEST_RECORDS ; i ++) {
838856 connection .bufferedWrite (
@@ -845,6 +863,7 @@ public void testRetryLargeResultSet() {
845863 }
846864 try (ITConnection connection =
847865 createConnection (interceptor , new CountTransactionRetryListener ())) {
866+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
848867 // select the test records and iterate over them
849868 try (AsyncResultSet rs =
850869 connection .executeQueryAsync (Statement .of ("SELECT * FROM TEST ORDER BY ID" ))) {
@@ -867,6 +886,7 @@ public void testRetryLargeResultSet() {
867886 // Wait until the entire result set has been consumed.
868887 get (finished );
869888 }
889+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
870890 // Do an update that will abort and retry.
871891 interceptor .setProbability (1.0 );
872892 interceptor .setOnlyInjectOnce (true );
@@ -898,6 +918,7 @@ public void testRetryHighAbortRate() {
898918 AbortInterceptor interceptor = new AbortInterceptor (0.25D );
899919 try (ITConnection connection =
900920 createConnection (interceptor , new CountTransactionRetryListener ())) {
921+ interceptor .setUsingMultiplexedSession (isMultiplexedSessionsEnabledForRW (connection .getSpanner ()));
901922 // insert test records
902923 for (int i = 0 ; i < NUMBER_OF_TEST_RECORDS ; i ++) {
903924 connection .bufferedWrite (
0 commit comments