Skip to content

Add a fuzz test for arbitrary string partitioning - #4608

Draft
jgao54 wants to merge 9 commits into
mainfrom
parallel-snapshot-fuzz-test
Draft

Add a fuzz test for arbitrary string partitioning#4608
jgao54 wants to merge 9 commits into
mainfrom
parallel-snapshot-fuzz-test

Conversation

@jgao54

@jgao54 jgao54 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

protos.MySqlFlavor_MYSQL_MYSQL, protos.MySqlReplicationMechanism_MYSQL_GTID)
conn, err := NewMySqlConnector(ctx, config)
if err != nil {
f.Skipf("mysql integration environment not available: %v", err)

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.

Fuzz tests are excluded from test runs by default, and if there's ever a fuzz job, we'd want it to not skip silently, so I think it's ok to require no error


var charsets []string
for cs := range collationsByCharset {
if _, ok := fuzzCharsetEncodings[cs]; ok {

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.

Do we expect CI mysql to routinely have charsets outside of the list? Failing on !ok could be a smoke probe if something gets added in a new version

raw = append(raw, byte(rng.UintN(256)))
}
}
f.Add(raw, uint8(idx), uint8(idx))

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.

nit: can add all combos of charset x collation, to not rely on the fuzzer for this

// exactly once by the partitions. Test requires PeerDB catalog and MySQL to be
// running. Example:
//
// go test ./connectors/mysql/ -run '^$' -fuzz '^FuzzMySQLStringPartitionCoverage$' -fuzztime 1h

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.

Suggested change
// go test ./connectors/mysql/ -run '^$' -fuzz '^FuzzMySQLStringPartitionCoverage$' -fuzztime 1h
// go test ./connectors/mysql/ -run '^$' -fuzz '^FuzzMySQLStringPartitionCoverage$' -fuzztime 1h -parallel=2

as 14 cores contend the mysql side

also for 1 min test I needed -fuzzminimizetime=1x (or at least 1s) to get a decent throughput but not sure what's optimal for 1h

Base automatically changed from arbitrary-string-parallel-snapshot to main July 24, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants