-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
cdctest: add mvcc_timestamp, diff, sink_config options to nemesis testing #139155
base: master
Are you sure you want to change the base?
Conversation
It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR? 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained
pkg/ccl/changefeedccl/cdctest/validator.go
line 388 at r5 (raw file):
} if *mvccJSONText > updated.AsOfSystemTime() {
Wondering if there's a better assertion that we can make here once the mvcc timestamp exists. If I assert that this mvcc timestamp is within up to 5 seconds of the updated timestamp, the tests fail (a few times in 100).
validators = append(validators, kivV) | ||
} | ||
|
||
if cfo.BooleanOptions["mvcc_timestamp"] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe use the constants in options.go instead of string literals
looks reasonable to me. let me know when it's ready for a full review |
ad8b23c
to
78d22d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ready for re-review
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @asg0451 and @wenyihu6)
} | ||
|
||
retry := make(map[string]any) | ||
if !isKafka && rand.Intn(2) < 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you clean up this function a bit? a lot of if isKafka &&
, maybe it can be nested or pulled out into a function that handles kafka specific stuff
compression := compressions[rand.Intn(len(compressions))] | ||
base["Compression"] = compression | ||
if compression == "GZIP" { | ||
level := rand.Intn(10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you allow -1 too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
|
||
jsonData, err := json.Marshal(nonEmptyConfig) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you return error here or panic or something?
return err | ||
} | ||
|
||
if *mvccJSONText > updated.AsOfSystemTime() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you also do a sanity check like > 0 or > yesterday?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
keyJSONAsArray, ok := keyJSON.AsArray() | ||
if !ok || len(keyJSONAsArray) != len(v.primaryKeyCols) { | ||
return errors.Errorf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably append to v.failures here instead of returning error. ditto for (some but not all) other errors in this method
if err != nil { | ||
t.Fatalf("got %v expected %v", err, nil) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: prefer assert.NoError(t, err)
or require.NoError(t, err)
for these
if err != nil { | ||
t.Fatalf("got %v expected %v", err, nil) | ||
} | ||
if f := v.Failures(); f != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and assert.Empty()
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the assertValidatorFailures now (with no failures) to match the rest of the file
78d22d8
to
f78327a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @asg0451 and @wenyihu6)
compression := compressions[rand.Intn(len(compressions))] | ||
base["Compression"] = compression | ||
if compression == "GZIP" { | ||
level := rand.Intn(10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
return err | ||
} | ||
|
||
if *mvccJSONText > updated.AsOfSystemTime() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
f78327a
to
0f6c777
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @asg0451 and @wenyihu6)
if err != nil { | ||
t.Fatalf("got %v expected %v", err, nil) | ||
} | ||
if f := v.Failures(); f != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the assertValidatorFailures now (with no failures) to match the rest of the file
0f6c777
to
080fcfc
Compare
…ting This work adds to random changefeed settings we pass into changefeeds in nemesis testing. This commit adds support for: changefeeds without the diff option specified, the mvcc_timestamp option and the kafka and pubsub sink configs. See also: cockroachdb#134119 Epic: CRDB-42866 Release note: None
080fcfc
to
0dc5872
Compare
This work adds to random changefeed settings we pass into changefeeds
in nemesis testing. This commit adds support for: changefeeds without
the diff option specified, the mvcc_timestamp option and the kafka and
pubsub sink configs.
See also: #134119
Epic: CRDB-42866
Release note: None