Skip to content

bulkio: Correctly group producer/consumers when importing data#49995

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
miretskiy:import2
Jun 9, 2020
Merged

bulkio: Correctly group producer/consumers when importing data#49995
craig[bot] merged 1 commit intocockroachdb:masterfrom
miretskiy:import2

Conversation

@miretskiy
Copy link
Copy Markdown
Contributor

Fixes #49989

Correctly link data import producer and consumer when importing data.
Using separate groups for producer and consumer could lead to a situation
where consumer exits (due to an error, or explicit context cancellation), while
producer does not realize that, leading to a deadlock.

Release notes (bug fix): Correctly link producer/consumer during data
import in order to handle errors correctly.

@miretskiy miretskiy requested review from a team, nvb and pbardea June 8, 2020 23:53
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

Copy link
Copy Markdown
Contributor

@nvb nvb left a comment

Choose a reason for hiding this comment

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

This :lgtm:, but the group/producerGroup split looks deliberate enough that it warrants either a) some archeology and an explanation on this PR about why it was built that way to begin with and why the split is not actually needed, or b) a review from @spaskob, who added it in 736e88d, or c) preferably both.

Thanks again for the quick fix!

Also, I meant to ask on the other PR - you're planning on backporting both of these to release-20.1, right?

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @miretskiy and @pbardea)


pkg/ccl/importccl/import_processor_test.go, line 442 at r1 (raw file):

}

func TestImportHandlesDuplicateKVs(t *testing.T) {

Nice test.

Copy link
Copy Markdown
Contributor

@pbardea pbardea left a comment

Choose a reason for hiding this comment

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

This also LGTM, but I agree with Nathan's proposal that this would probably benefit from a quick look from @spaskob to ensure that everything is indeed what we expect.

@spaskob
Copy link
Copy Markdown
Contributor

spaskob commented Jun 9, 2020

:lgtm:

@miretskiy
Copy link
Copy Markdown
Contributor Author

Thanks for the reviews. I did do some digging. From what I can tell, this was simply a refactoring move, trying to perturb the code the least. There used to be input finished call, which was responsible for closing kvch. The refactor removed that.

It is simply no correct to have 2 groups. The issue with deadlock was that when one of the workers in group B exits (ingetstKV returns error), the other worker responsible for
waiting for the import to finish, would never finish since workers in Group A try to write to channel that nobody reads from. There is no communication (vis-a-vis errors, and/or cancellation) between group B and A.

@spaskob
Copy link
Copy Markdown
Contributor

spaskob commented Jun 9, 2020 via email

Fixes cockroachdb#49989

Correctly link data import producer and consumer when importing data.
Using separate groups for producer and consumer could lead to a situation
where consumer exits (due to an error, or explicit context cancellation), while
producer does not realize that, leading to a deadlock.

Release notes (bug fix): Correctly link producer/consumer during data
import in order to handle errors correctly.
@miretskiy
Copy link
Copy Markdown
Contributor Author

Also, CI failures were due to the stress test because I also need the fix already submitted (to parallel producer). The newly added test also triggers the other deadlock bug #49977

@miretskiy
Copy link
Copy Markdown
Contributor Author

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jun 9, 2020

Build succeeded

@craig craig bot merged commit 86c4fbd into cockroachdb:master Jun 9, 2020
@miretskiy miretskiy deleted the import2 branch June 9, 2020 20:48
craig bot pushed a commit that referenced this pull request Jun 12, 2020
50089: release-20.1: bulkio:  import no longer gets stuck due to errors encountered during import r=miretskiy a=miretskiy

Backport:
  * 1/1 commits from "importccl: Correctly handle errors and cancellations during import." (#49979)
  * 1/1 commits from "bulkio: Correctly group producer/consumers when importing data" (#49995)

Please see individual PRs for details.

/cc @cockroachdb/release


Co-authored-by: Yevgeniy Miretskiy <yevgeniy@cockroachlabs.com>
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.

bulkio: error from ingestKvs causes deadlock

5 participants