diff --git a/pkg/ccl/streamingccl/streamproducer/event_stream.go b/pkg/ccl/streamingccl/streamproducer/event_stream.go index a38ed1d9628a..e226b3ef90c0 100644 --- a/pkg/ccl/streamingccl/streamproducer/event_stream.go +++ b/pkg/ccl/streamingccl/streamproducer/event_stream.go @@ -306,7 +306,13 @@ func (s *eventStream) onMetadata(ctx context.Context, metadata *kvpb.RangeFeedMe if metadata.FromManualSplit && !metadata.Span.Key.Equal(metadata.ParentStartKey) { // Only send new manual split keys (i.e. a child rangefeed start key that // differs from the parent start key) + if s.addMu != nil { + // Split points can be sent concurrently during the initial scan. + s.addMu.Lock() + defer s.addMu.Unlock() + } s.seb.addSplitPoint(metadata.Span.Key) + s.setErr(s.maybeFlushBatch(ctx)) } }