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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion build/bazelutil/nogo_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@
},
"nilness": {
"exclude_files": {
"cockroach/pkg/ccl/streamingccl/streamclient/random_stream_client.go": "https://github.com/cockroachdb/cockroach/issues/79926",
"cockroach/pkg/.*\\.eg\\.go$": "generated code",
".*\\.pb\\.go$": "generated code",
".*\\.pb\\.gw\\.go$": "generated code",
Expand Down
6 changes: 4 additions & 2 deletions pkg/ccl/streamingccl/streamclient/random_stream_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ func (m *randomStreamClient) Subscribe(

rng, _ := randutil.NewPseudoRand()

var keyValCopy *roachpb.KeyValue
for {
var event streamingccl.Event
var keyValCopy *roachpb.KeyValue
if numKVEventsSinceLastResolved == config.kvsPerCheckpoint {
// Emit a CheckpointEvent.
resolvedTime := timeutil.Now()
Expand Down Expand Up @@ -407,7 +407,9 @@ func (m *randomStreamClient) Subscribe(
if event.Type() == streamingccl.KVEvent {
// Use the originally generated KeyValue copy as the KeyValue inside the event might
// get modified by ingestion processor's tenant rekeyer.
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...

}
func() {
m.mu.Lock()
Expand Down