Skip to content

Commit 7a3bab1

Browse files
committed
workload: use IMPORT by default, but warn against uniqueness violations
In 1041bf0 (#152979), we converted ycsb and kv workloads to use INSERT statements for initial data loading when hashing keys. Hashing keys can cause key collisions. At higher row counts, these collisions are inevitable. Since IMPORTs require imported data to be unique, an IMPORT with colliding keys would fail. Before #152979, only the ycsb workload was susceptible to this failure mode, because the kv workload did not use the same key generator for data loaded through --insert-count (#107874). Fixing #107874 made the kv workload susceptible to this type of failure. The change to use INSERTs instead of IMPORTs ran afoul of KV message size limits (see #153086). For now we revert the change to automatically use IMPORTs and instead warn about the possibility of collisions. Epic: none Release note: none
1 parent ab4a9cb commit 7a3bab1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/ccl/workloadccl/fixture.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"math"
1616
"net/url"
1717
"path/filepath"
18+
"slices"
1819
"strconv"
1920
"strings"
2021
"sync/atomic"
@@ -310,6 +311,12 @@ func (l ImportDataLoader) InitialDataLoad(
310311
if l.FilesPerNode == 0 {
311312
l.FilesPerNode = 1
312313
}
314+
mayContainDuplicates := slices.ContainsFunc(gen.Tables(), func(tbl workload.Table) bool {
315+
return tbl.InitialRows.MayContainDuplicates
316+
})
317+
if mayContainDuplicates {
318+
log.Dev.Warningf(ctx, "importing fixture using a key generator that may contain duplicates; IMPORT may abort with a key uniqueness violation at higher row counts")
319+
}
313320

314321
log.Dev.Infof(ctx, "starting import of %d tables", len(gen.Tables()))
315322
start := timeutil.Now()

pkg/workload/workload.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type Generator interface {
4646
func SupportsFixtures(gen Generator) bool {
4747
tt := gen.Tables()
4848
for _, t := range tt {
49-
if t.InitialRows.FillBatch == nil || t.InitialRows.MayContainDuplicates {
49+
if t.InitialRows.FillBatch == nil {
5050
return false
5151
}
5252
}

0 commit comments

Comments
 (0)