Skip to content

Commit

Permalink
streamingccl: Fix nil linter check error and stream_ingestion_test error
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gh-casper committed Apr 13, 2022
1 parent 4fb314a commit 090fe25
Showing 1 changed file with 4 additions and 2 deletions.
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))
}
func() {
m.mu.Lock()
Expand Down

0 comments on commit 090fe25

Please sign in to comment.