Skip to content

Commit c9c83a9

Browse files
committed
roachtest/import: add concurrent import tests
Previously, the import-cancellation roachtest would load the entire TPC-H dataset in parallel. When this test was ported over to the new, fingerprint validating, import test we no longer needed to load the entire dataset to validate the import was successful (the old test simply ran the workload to ensure the data wasn't corrupt). For simplicity at the time, this seemed fine, but it did lose the test of concurrent imports into separate tables that the old test had. This patch adds concurrency back to the import/cancellation test and adds a separate import/concurrency test, both of which load three files in parallel. Fixes: #157242 Release note: None
1 parent 930e2ef commit c9c83a9

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

pkg/cmd/roachtest/tests/import.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,20 @@ func allDatasets(_ *rand.Rand) []string {
174174
return slices.Collect(maps.Keys(datasets))
175175
}
176176

177-
func anyDataset(rng *rand.Rand) []string {
177+
func nDatasets(rng *rand.Rand, n int) []string {
178178
allDatasets := allDatasets(rng)
179-
return []string{allDatasets[rng.Intn(len(allDatasets))]}
179+
rng.Shuffle(len(allDatasets), func(i, j int) {
180+
allDatasets[i], allDatasets[j] = allDatasets[j], allDatasets[i]
181+
})
182+
return allDatasets[:n]
183+
}
184+
185+
func anyThreeDatasets(rng *rand.Rand) []string {
186+
return nDatasets(rng, 3)
187+
}
188+
189+
func anyDataset(rng *rand.Rand) []string {
190+
return nDatasets(rng, 1)
180191
}
181192

182193
// importTestSpec represents a subtest within the import test.
@@ -232,6 +243,12 @@ var tests = []importTestSpec{
232243
nodes: []int{4},
233244
datasetNames: One("tpch/lineitem"),
234245
},
246+
// Basic test importing three datasets concurrently.
247+
{
248+
subtestName: "concurrency",
249+
nodes: []int{4},
250+
datasetNames: FromFunc(anyThreeDatasets),
251+
},
235252
// Test with a decommissioned node.
236253
{
237254
subtestName: "decommissioned",
@@ -280,7 +297,7 @@ var tests = []importTestSpec{
280297
{
281298
subtestName: "cancellation",
282299
nodes: []int{4},
283-
datasetNames: FromFunc(anyDataset),
300+
datasetNames: FromFunc(anyThreeDatasets),
284301
importRunner: importCancellationRunner,
285302
},
286303
}

0 commit comments

Comments
 (0)