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

streamingccl: fix nil linter check error and stream_ingestion_test error #79935

Merged
merged 1 commit into from
Apr 18, 2022

Conversation

gh-casper
Copy link
Contributor

@gh-casper gh-casper commented Apr 13, 2022

Previously, the stream ingestion test has no error since no
duplicate event is generated. This PR fixes this and nil linter
check error at the same time.

Release note: None
Closes: #79926

Related to #79929 which
disables random_stream_client nil linter check. Will re-enable it after it's
merged.

@gh-casper gh-casper requested a review from rickystewart April 13, 2022 23:46
@gh-casper gh-casper requested a review from a team as a code owner April 13, 2022 23:46
@gh-casper gh-casper requested review from ajwerner and removed request for a team April 13, 2022 23:46
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@gh-casper gh-casper requested review from samiskin and removed request for ajwerner April 13, 2022 23:47
@gh-casper
Copy link
Contributor Author

@rickystewart Thanks for finding this!

event = streamingccl.MakeKVEvent(*keyValCopy)
// 'keyValCopy' will only be set when it is a KV event. Copying the 'keyValCopy' again
// to prevent the event being modified by interceptor again.
event = streamingccl.MakeKVEvent(*copyKeyVal(keyValCopy))
Copy link
Contributor

Choose a reason for hiding this comment

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

perhaps are apis are not good? I don't understand why we need a copy of a copy...

Previously, the stream ingestion test has no error since no
duplicate event is generated. This PR fixes this and nil linter
check error at the same time.

Release note: None
@gh-casper gh-casper requested a review from a team as a code owner April 18, 2022 16:07
Copy link
Contributor Author

@gh-casper gh-casper left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @miretskiy and @samiskin)


pkg/ccl/streamingccl/streamclient/random_stream_client.go, line 412 at r1 (raw file):

Previously, miretskiy (Yevgeniy Miretskiy) wrote…

perhaps are apis are not good? I don't understand why we need a copy of a copy...

The reason we want to make a copy at the first place is that the generated KV event might get modified downstream. The flow looks like this: generate a event, make a copy for this event, event goes to streamclient's channel and gets modified, use the copy the create a event which will passed into interceptor which may modify the event. In the last step, if we use MakeKVEvent to use copy's value to create a event, then the copy will be modified as well. This copy should not be modified because it will be used when we generate the next duplicate event, so we have to create another copy.

Code quote:

streamingccl.MakeKVEvent

@gh-casper
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Apr 18, 2022

Build succeeded:

@craig craig bot merged commit b34f42d into cockroachdb:master Apr 18, 2022
@shermanCRL shermanCRL added the A-tenant-streaming Including cluster streaming label Jun 28, 2022
@shermanCRL shermanCRL added this to the 22.1 milestone Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tenant-streaming Including cluster streaming
Projects
None yet
Development

Successfully merging this pull request may close these issues.

streamclient: suspect code in random_stream_client.go
5 participants