Skip to content

chore(spanner): clean up pre-existing backup schedules in samples and increase wait timeout - #14221

Open
sakthivelmanii wants to merge 2 commits into
mainfrom
fix-spanner-schedule-limit-and-harness-timeout
Open

chore(spanner): clean up pre-existing backup schedules in samples and increase wait timeout#14221
sakthivelmanii wants to merge 2 commits into
mainfrom
fix-spanner-schedule-limit-and-harness-timeout

Conversation

@sakthivelmanii

@sakthivelmanii sakthivelmanii commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Clean up pre-existing backup schedules in samples and increase replica harness wait timeout.

@sakthivelmanii
sakthivelmanii requested review from a team as code owners August 31, 2026 19:54

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request increases the timeout from 10 to 30 seconds in LocationAwareSharedBackendReplicaHarnessTest to prevent test flakiness. It also introduces a pre-test cleanup mechanism for backup schedules across several integration tests by adding a @before hook that invokes a new helper method cleanUpPreExistingBackupSchedules in SampleTestBaseV2. I have no feedback to provide as there are no review comments.

@olavloite olavloite changed the title chore(spanner): clean up pre-existing backup schedules in samples and… Sep 1, 2026

@Before
public void cleanUpPreExistingBackupSchedules() {
cleanUpPreExistingBackupSchedules(instanceId, databaseId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Aren't these integration tests configured to run concurrently? If so, then we risk that any backup test might delete all backup schedules, which again will interfere with any test that verifies that backup schedules can be created / deleted.


private static int waitForReplicaRoutedRead(
DatabaseClient client, SharedBackendReplicaHarness harness) throws InterruptedException {
long deadlineNanos = System.nanoTime() + TimeUnit.SECONDS.toNanos(10);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we also update this timeout? And check if there are more places where we should consider increasing the timeout? (But see also the comment below)

DatabaseClient client, SharedBackendReplicaHarness harness, int expectedReplicaIndex)
throws InterruptedException {
long deadlineNanos = System.nanoTime() + TimeUnit.SECONDS.toNanos(10);
long deadlineNanos = System.nanoTime() + TimeUnit.SECONDS.toNanos(30);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A timeout of 30 seconds (but also 10 seconds...) in something that is intended to be a unit test sounds a bit like a code smell. Why do we need such a high timeout?

Can we check for better testing strategies than this? E.g. waiting for deterministically for specific requests or events that we expect? Use latches to synchronize specific actions? etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants