Skip to content

streamingest: wait for all goroutines on streamIngestProcessor shutdown #72650

Merged
craig[bot] merged 3 commits intocockroachdb:masterfrom
andreimatei:stream-goroutines
Nov 11, 2021
Merged

streamingest: wait for all goroutines on streamIngestProcessor shutdown #72650
craig[bot] merged 3 commits intocockroachdb:masterfrom
andreimatei:stream-goroutines

Conversation

@andreimatei
Copy link
Copy Markdown
Contributor

This processor was failing to stop and wait for some of the goroutines it
spawned, which is not nice (in particular, it's likely that those
goroutines were using a tracing span after it was finished).

Release note: None

The checked chan is never nil.

Release note: None
This processor was failing to stop and wait for some of the goroutines it
spawned, which is not nice (in particular, it's likely that those
goroutines were using a tracing span after it was finished).

Release note: None
@andreimatei andreimatei requested review from a team, adityamaru and yuzefovich November 11, 2021 17:21
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@andreimatei
Copy link
Copy Markdown
Contributor Author

I pulled this out of the bigger PR cause I had gotten it wrong.

Copy link
Copy Markdown
Member

@yuzefovich yuzefovich left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r1, 2 of 2 files at r2, 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @adityamaru and @andreimatei)


pkg/ccl/streamingccl/streamingest/stream_ingestion_processor.go, line 313 at r3 (raw file):

	sip.pollingWaitGroup.Wait()
	// Wait for the merge goroutine.
	sip.cancelMergeAndWait()

In an error case it's possible that cancelMergeAndWait is never set (i.e. we short-circuit Start method before merge is called), so it might be worth either checking here for nil or set this function to a non-nil noop in the constructor.

This processor was calling InternalClose() while goroutines were still
running. InternalClose() finishes the processor's tracing span, which is
used by those goroutines. We don't like span use-after-Finish.

Release note: None
Copy link
Copy Markdown
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

TFTR!

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @adityamaru and @yuzefovich)


pkg/ccl/streamingccl/streamingest/stream_ingestion_processor.go, line 313 at r3 (raw file):

Previously, yuzefovich (Yahor Yuzefovich) wrote…

In an error case it's possible that cancelMergeAndWait is never set (i.e. we short-circuit Start method before merge is called), so it might be worth either checking here for nil or set this function to a non-nil noop in the constructor.

done

Copy link
Copy Markdown
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @adityamaru and @yuzefovich)

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Nov 11, 2021

Build succeeded:

@craig craig bot merged commit 4300949 into cockroachdb:master Nov 11, 2021
@andreimatei andreimatei deleted the stream-goroutines branch January 21, 2022 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants