Skip to content

Commit d754ec5

Browse files
committed
chore(spanner): remove temp fixes
1 parent 1f9cd79 commit d754ec5

File tree

9 files changed

+98
-75
lines changed

9 files changed

+98
-75
lines changed

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITAsyncTransactionRetryTest.java

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ public boolean doCreateDefaultTestTable() {
9191
@Before
9292
public void clearTable() {
9393
try (ITConnection connection = createConnection()) {
94-
connection.execute(Statement.of("SELECT 1"));
95-
connection.commit();
9694
connection.bufferedWrite(Mutation.delete("TEST", KeySet.all()));
97-
//connection.executeUpdate(Statement.of("DELETE FROM TEST WHERE TRUE"));
9895
get(connection.commitAsync());
9996
}
10097
}
@@ -224,7 +221,8 @@ public void testCommitAborted() {
224221
AbortInterceptor interceptor = new AbortInterceptor(0);
225222
try (ITConnection connection =
226223
createConnection(interceptor, new CountTransactionRetryListener())) {
227-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
224+
interceptor.setUsingMultiplexedSession(
225+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
228226
ApiFuture<Long> count = getTestRecordCountAsync(connection);
229227
// do an insert
230228
ApiFuture<Long> updateCount =
@@ -257,7 +255,8 @@ public void testInsertAborted() {
257255
AbortInterceptor interceptor = new AbortInterceptor(0);
258256
try (ITConnection connection =
259257
createConnection(interceptor, new CountTransactionRetryListener())) {
260-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
258+
interceptor.setUsingMultiplexedSession(
259+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
261260
ApiFuture<Long> count = getTestRecordCountAsync(connection);
262261
// indicate that the next statement should abort
263262
interceptor.setProbability(1.0);
@@ -281,7 +280,8 @@ public void testUpdateAborted() {
281280
AbortInterceptor interceptor = new AbortInterceptor(0);
282281
try (ITConnection connection =
283282
createConnection(interceptor, new CountTransactionRetryListener())) {
284-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
283+
interceptor.setUsingMultiplexedSession(
284+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
285285
ApiFuture<Long> count = getTestRecordCountAsync(connection);
286286
// insert a test record
287287
connection.executeUpdateAsync(
@@ -315,7 +315,8 @@ public void testQueryAborted() {
315315
AbortInterceptor interceptor = new AbortInterceptor(0);
316316
try (ITConnection connection =
317317
createConnection(interceptor, new CountTransactionRetryListener())) {
318-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
318+
interceptor.setUsingMultiplexedSession(
319+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
319320
// insert a test record
320321
connection.executeUpdateAsync(
321322
Statement.of("INSERT INTO TEST (ID, NAME) VALUES (1, 'test aborted')"));
@@ -366,7 +367,8 @@ public void testNextCallAborted() {
366367
AbortInterceptor interceptor = new AbortInterceptor(0);
367368
try (ITConnection connection =
368369
createConnection(interceptor, new CountTransactionRetryListener())) {
369-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
370+
interceptor.setUsingMultiplexedSession(
371+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
370372
// insert two test records
371373
connection.executeUpdateAsync(
372374
Statement.of("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')"));
@@ -400,7 +402,8 @@ public void testMultipleAborts() {
400402
AbortInterceptor interceptor = new AbortInterceptor(0);
401403
try (ITConnection connection =
402404
createConnection(interceptor, new CountTransactionRetryListener())) {
403-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
405+
interceptor.setUsingMultiplexedSession(
406+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
404407
ApiFuture<Long> count = getTestRecordCountAsync(connection);
405408
// do three inserts which all will abort and retry
406409
interceptor.setProbability(1.0);
@@ -437,7 +440,8 @@ public void testAbortAfterSelect() {
437440
AbortInterceptor interceptor = new AbortInterceptor(0);
438441
try (ITConnection connection =
439442
createConnection(interceptor, new CountTransactionRetryListener())) {
440-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
443+
interceptor.setUsingMultiplexedSession(
444+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
441445
ApiFuture<Long> count = getTestRecordCountAsync(connection);
442446
// insert a test record
443447
connection.executeUpdateAsync(
@@ -514,7 +518,8 @@ public void testAbortWithResultSetHalfway() {
514518
AbortInterceptor interceptor = new AbortInterceptor(0);
515519
try (ITConnection connection =
516520
createConnection(interceptor, new CountTransactionRetryListener())) {
517-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
521+
interceptor.setUsingMultiplexedSession(
522+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
518523
// insert two test records
519524
connection.executeUpdateAsync(
520525
Statement.of("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')"));
@@ -550,7 +555,8 @@ public void testAbortWithResultSetFullyConsumed() {
550555
AbortInterceptor interceptor = new AbortInterceptor(0);
551556
try (ITConnection connection =
552557
createConnection(interceptor, new CountTransactionRetryListener())) {
553-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
558+
interceptor.setUsingMultiplexedSession(
559+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
554560
// insert two test records
555561
connection.executeUpdateAsync(
556562
Statement.of("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')"));
@@ -593,7 +599,8 @@ public void testAbortWithConcurrentInsert() {
593599
AbortInterceptor interceptor = new AbortInterceptor(0);
594600
try (ITConnection connection =
595601
createConnection(interceptor, new CountTransactionRetryListener())) {
596-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
602+
interceptor.setUsingMultiplexedSession(
603+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
597604
// insert two test records
598605
connection.executeUpdateAsync(
599606
Statement.of("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')"));
@@ -645,7 +652,8 @@ public void testAbortWithConcurrentDelete() {
645652
AbortInterceptor interceptor = new AbortInterceptor(0);
646653
// first insert two test records
647654
try (ITConnection connection = createConnection()) {
648-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
655+
interceptor.setUsingMultiplexedSession(
656+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
649657
connection.executeUpdateAsync(
650658
Statement.of("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')"));
651659
connection.executeUpdateAsync(
@@ -655,7 +663,8 @@ public void testAbortWithConcurrentDelete() {
655663
// open a new connection and select the two test records
656664
try (ITConnection connection =
657665
createConnection(interceptor, new CountTransactionRetryListener())) {
658-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
666+
interceptor.setUsingMultiplexedSession(
667+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
659668
// select the test records and consume the entire result set
660669
try (AsyncResultSet rs =
661670
connection.executeQueryAsync(Statement.of("SELECT * FROM TEST ORDER BY ID"))) {
@@ -709,7 +718,8 @@ public void testAbortWithConcurrentUpdate() {
709718
// open a new connection and select the two test records
710719
try (ITConnection connection =
711720
createConnection(interceptor, new CountTransactionRetryListener())) {
712-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
721+
interceptor.setUsingMultiplexedSession(
722+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
713723
// select the test records and consume the entire result set
714724
try (AsyncResultSet rs =
715725
connection.executeQueryAsync(Statement.of("SELECT * FROM TEST ORDER BY ID"))) {
@@ -760,7 +770,8 @@ public void testAbortWithUnseenConcurrentInsert() throws InterruptedException {
760770
AbortInterceptor interceptor = new AbortInterceptor(0);
761771
try (ITConnection connection =
762772
createConnection(interceptor, new CountTransactionRetryListener())) {
763-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
773+
interceptor.setUsingMultiplexedSession(
774+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
764775
// insert three test records
765776
connection.executeUpdateAsync(
766777
Statement.of("INSERT INTO TEST (ID, NAME) VALUES (1, 'test 1')"));
@@ -850,7 +861,8 @@ public void testRetryLargeResultSet() {
850861
final long UPDATED_RECORDS = 1000L;
851862
AbortInterceptor interceptor = new AbortInterceptor(0);
852863
try (ITConnection connection = createConnection()) {
853-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
864+
interceptor.setUsingMultiplexedSession(
865+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
854866
// insert test records
855867
for (int i = 0; i < NUMBER_OF_TEST_RECORDS; i++) {
856868
connection.bufferedWrite(
@@ -863,7 +875,8 @@ public void testRetryLargeResultSet() {
863875
}
864876
try (ITConnection connection =
865877
createConnection(interceptor, new CountTransactionRetryListener())) {
866-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
878+
interceptor.setUsingMultiplexedSession(
879+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
867880
// select the test records and iterate over them
868881
try (AsyncResultSet rs =
869882
connection.executeQueryAsync(Statement.of("SELECT * FROM TEST ORDER BY ID"))) {
@@ -886,7 +899,8 @@ public void testRetryLargeResultSet() {
886899
// Wait until the entire result set has been consumed.
887900
get(finished);
888901
}
889-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
902+
interceptor.setUsingMultiplexedSession(
903+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
890904
// Do an update that will abort and retry.
891905
interceptor.setProbability(1.0);
892906
interceptor.setOnlyInjectOnce(true);
@@ -918,7 +932,8 @@ public void testRetryHighAbortRate() {
918932
AbortInterceptor interceptor = new AbortInterceptor(0.25D);
919933
try (ITConnection connection =
920934
createConnection(interceptor, new CountTransactionRetryListener())) {
921-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
935+
interceptor.setUsingMultiplexedSession(
936+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
922937
// insert test records
923938
for (int i = 0; i < NUMBER_OF_TEST_RECORDS; i++) {
924939
connection.bufferedWrite(

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITCommitResponseTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import static org.junit.Assert.assertTrue;
2424
import static org.junit.Assume.assumeFalse;
2525

26-
import com.google.cloud.spanner.BackupInfo.State;
2726
import com.google.cloud.spanner.KeySet;
2827
import com.google.cloud.spanner.Mutation;
2928
import com.google.cloud.spanner.ParallelIntegrationTest;
@@ -52,10 +51,7 @@ public boolean doCreateDefaultTestTable() {
5251
@Before
5352
public void clearTestData() {
5453
try (ITConnection connection = createConnection()) {
55-
connection.execute(Statement.of("SELECT 1"));
56-
connection.commit();
5754
connection.bufferedWrite(Mutation.delete("TEST", KeySet.all()));
58-
//connection.executeUpdate(Statement.of("DELETE FROM TEST WHERE TRUE"));
5955
connection.commit();
6056
}
6157
}

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITDelayBeginTransactionTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ public boolean doCreateDefaultTestTable() {
5353
@Before
5454
public void setupTestData() {
5555
try (ITConnection connection = createConnection()) {
56-
connection.execute(Statement.of("SELECT 1"));
57-
connection.commit();
5856
connection.bufferedWrite(Mutation.delete("TEST", KeySet.all()));
5957
connection.commit();
6058

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITExplainTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import com.google.cloud.spanner.Statement;
2929
import com.google.cloud.spanner.connection.Connection;
3030
import com.google.cloud.spanner.connection.ITAbstractSpannerTest;
31-
import com.google.common.collect.ImmutableList;
3231
import java.util.Arrays;
3332
import java.util.Collections;
3433
import org.junit.Before;
@@ -65,19 +64,12 @@ public void createTestTable() {
6564
connection.runBatch();
6665
}
6766
}
68-
try {
69-
Thread.sleep(3000);
70-
} catch (Exception e) {
71-
System.out.println(e);
72-
}
7367
}
7468

7569
@Test
7670
public void testExplainStatement() {
7771
assumeFalse("Emulator does not support PostgreSQL Dialect", isUsingEmulator());
7872
try (ITConnection connection = createConnection()) {
79-
connection.execute(Statement.of("SELECT 1"));
80-
connection.commit();
8173
connection.bufferedWrite(
8274
Arrays.asList(
8375
Mutation.newInsertBuilder("TEST").set("ID").to(3L).set("NAME").to("TEST-3").build(),
@@ -97,8 +89,6 @@ public void testExplainStatement() {
9789
public void testExplainAnalyzeStatement() {
9890
assumeFalse("Emulator does not support PostgreSQL Dialect", isUsingEmulator());
9991
try (ITConnection connection = createConnection()) {
100-
connection.execute(Statement.of("SELECT 1"));
101-
connection.commit();
10292
connection.bufferedWrite(
10393
Arrays.asList(
10494
Mutation.newInsertBuilder("TEST").set("ID").to(1L).set("NAME").to("TEST-1").build(),

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITReadOnlySpannerTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public void createTestTables() throws Exception {
6969
verifier.verifyStatementsInFile(
7070
"ITReadOnlySpannerTest_CreateTables.sql", SqlScriptVerifier.class, false);
7171

72-
connection.execute(Statement.of("SELECT 1"));
7372
// fill tables with data
7473
connection.setAutocommit(false);
7574
connection.setReadOnly(false);

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITSavepointTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ public boolean doCreateDefaultTestTable() {
5151
@Before
5252
public void clearTestData() {
5353
try (ITConnection connection = createConnection()) {
54-
connection.execute(Statement.of("SELECT 1"));
55-
connection.commit();
5654
connection.bufferedWrite(Mutation.delete("TEST", KeySet.all()));
5755
connection.commit();
5856
}

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITSqlMusicScriptTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public void test02_RunAbortedTest() {
7171
long numberOfSongs = 0L;
7272
AbortInterceptor interceptor = new AbortInterceptor(0.0D);
7373
try (ITConnection connection = createConnection(interceptor)) {
74-
interceptor.setUsingMultiplexedSession(isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
74+
interceptor.setUsingMultiplexedSession(
75+
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
7576
connection.setAutocommit(false);
7677
connection.setRetryAbortsInternally(true);
7778
// Read all data from the different music tables in the transaction

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/it/ITTransactionModeTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ public void testSqlScript() throws Exception {
6060
public void testDoAllowBufferedWriteInReadWriteTransaction() {
6161
try (ITConnection connection = createConnection()) {
6262
assertThat(connection.isAutocommit(), is(false));
63-
connection.execute(Statement.of("SELECT 1"));
64-
connection.commit();
6563
connection.bufferedWrite(
6664
Mutation.newInsertBuilder("TEST").set("ID").to(1L).set("NAME").to("TEST").build());
6765
connection.commit();

0 commit comments

Comments
 (0)