Skip to content

chore: unflake asyncTransactionManagerWaitsUntilAsyncBatchUpdateHasFinished #3258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.google.common.collect.Range;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.GeneratedMessageV3;
import com.google.spanner.v1.BatchCreateSessionsRequest;
import com.google.spanner.v1.BeginTransactionRequest;
import com.google.spanner.v1.CommitRequest;
Expand Down Expand Up @@ -983,17 +984,13 @@ public void asyncTransactionManagerWaitsUntilAsyncBatchUpdateHasFinished() throw
}
}
}
ImmutableList<Class<? extends GeneratedMessageV3>> expectedRequests =
ImmutableList.of(
BatchCreateSessionsRequest.class, ExecuteBatchDmlRequest.class, CommitRequest.class);
if (isMultiplexedSessionsEnabled()) {
assertThat(mockSpanner.getRequestTypes())
.containsExactly(
CreateSessionRequest.class,
BatchCreateSessionsRequest.class,
ExecuteBatchDmlRequest.class,
CommitRequest.class);
assertThat(mockSpanner.getRequestTypes()).containsAtLeastElementsIn(expectedRequests);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AsyncTransactionManager does not support multiplexed sessions yet. Just curious to understand at what condition this flakiness is occurring?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although read/write transactions do not support multiplexed sessions, we do pre-emptively create a multiplexed session asynchronously when a client is created with multiplexed sessions enabled. We do this to try to avoid that the first query that can use multiplexed sessions has to wait for it. That again means that these tests might or might not see a multiplexed session being created (random, because the request is executed async). As the multiplexed session is not used here, we just choose to ignore it in the test, as it is irrelevant.

} else {
assertThat(mockSpanner.getRequestTypes())
.containsExactly(
BatchCreateSessionsRequest.class, ExecuteBatchDmlRequest.class, CommitRequest.class);
assertThat(mockSpanner.getRequestTypes()).containsExactlyElementsIn(expectedRequests);
}
}

Expand Down
Loading