Skip to content
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

[OnlineDDL] add label so break works as intended #13691

Merged
merged 2 commits into from
Aug 3, 2023
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 @@ -372,6 +372,7 @@ func checkTablesCount(t *testing.T, tablet *cluster.Vttablet, showTableName stri
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
rowcount := 0

for {
queryResult, err := tablet.VttabletProcess.QueryTablet(query, keyspaceName, true)
require.Nil(t, err)
Expand All @@ -382,10 +383,14 @@ func checkTablesCount(t *testing.T, tablet *cluster.Vttablet, showTableName stri

select {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

alternatively we could go with:

for {
    // all the original loop before the select ...

    select {
    case <-time.After(time.Second):
        continue
    case <-ctx.Done():
    }
    break
}

assert.Equal(...)

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use this approach. We generally do not use labels in the vitess codebase -- not sure that there's any decision per-se, but we just don't use them, so let's continue not using them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sgtm!

case <-time.After(time.Second):
continue // Keep looping
case <-ctx.Done():
break
// Break below to the assertion
}

break
}

assert.Equal(t, expectCount, rowcount)
}

Expand Down