Skip to content

rangefeed: add release valve to logical op consumption#29076

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/rangefeedReleaseValve
Aug 27, 2018
Merged

rangefeed: add release valve to logical op consumption#29076
craig[bot] merged 1 commit intocockroachdb:masterfrom
nvb:nvanbenschoten/rangefeedReleaseValve

Conversation

@nvb
Copy link
Copy Markdown
Contributor

@nvb nvb commented Aug 26, 2018

This change adds a new EventChanTimeout configuration to
rangefeed.Processor. The config specifies the maximum duration
that ConsumeLogicalOps and ForwardClosedTS will block on the
Processor's input channel. Once the duration is exceeded, these
methods will stops the processor with an error and tear it down.
This prevents slow consumers from making callers of the two methods
block.

The first method is used downstream of Raft, where blocking due to
slow rangefeed consumers for an unbounded amount of time is unacceptable.
It may require that we resize the processor's input buffer.

A TODO is left about reducing the impact of a single slow consumer
on an entire rangefeed.Processor. This can be left as a future
improvement.

Release note: None

@nvb nvb requested review from a team and danhhz August 26, 2018 17:32
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 26, 2018

Please don't review this yet. I'm changing up the interface a bit to be more useful.

@nvb nvb force-pushed the nvanbenschoten/rangefeedReleaseValve branch from 3c7f7e6 to 3135149 Compare August 27, 2018 04:44
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 27, 2018

Ok, this is good to review now.

Copy link
Copy Markdown
Member

@tbg tbg 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 5 of 5 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/storage/rangefeed/processor.go, line 53 at r1 (raw file):

// Stream.SendAsync and give each stream its own individual buffer. If
// an individual stream is unable to keep up, to should fail on its own.
var errBufferCapacityExceeded = roachpb.NewErrorf("rangefeed: buffer capacity exceeded")

I don't know that there is a problem in this code, but we do usually mutate *Error on the way out, so there's a chance this singleton will be polluted if not cloned appropriately at any place where it's used (and so you might as well make this a factory).

@nvb nvb force-pushed the nvanbenschoten/rangefeedReleaseValve branch from 3135149 to 84b6de8 Compare August 27, 2018 11:30
Copy link
Copy Markdown
Contributor Author

@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.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/storage/rangefeed/processor.go, line 53 at r1 (raw file):

Previously, tschottdorf (Tobias Schottdorf) wrote…

I don't know that there is a problem in this code, but we do usually mutate *Error on the way out, so there's a chance this singleton will be polluted if not cloned appropriately at any place where it's used (and so you might as well make this a factory).

Good point, done!

This change adds a new `EventChanTimeout` configuration to
`rangefeed.Processor`. The config specifies the maximum duration
that `ConsumeLogicalOps` and `ForwardClosedTS` will block on the
Processor's input channel. Once the duration is exceeded, these
methods will stops the processor with an error and tear it down.
This prevents slow consumers from making callers of the two methods
block.

The first method is used downstream of Raft, where blocking due to
slow rangefeed consumers for an unbounded amount of time is unacceptable.
It may require that we resize the processor's input buffer.

A TODO is left about reducing the impact of a single slow consumer
on an entire rangefeed.Processor. This can be left as a future
improvement.

Release note: None
@nvb nvb force-pushed the nvanbenschoten/rangefeedReleaseValve branch from 84b6de8 to 412bb9b Compare August 27, 2018 11:55
@nvb
Copy link
Copy Markdown
Contributor Author

nvb commented Aug 27, 2018

bors r+

craig bot pushed a commit that referenced this pull request Aug 27, 2018
29076: rangefeed: add release valve to logical op consumption r=nvanbenschoten a=nvanbenschoten

This change adds a new `EventChanTimeout` configuration to
`rangefeed.Processor`. The config specifies the maximum duration
that `ConsumeLogicalOps` and `ForwardClosedTS` will block on the
Processor's input channel. Once the duration is exceeded, these
methods will stops the processor with an error and tear it down.
This prevents slow consumers from making callers of the two methods
block.

The first method is used downstream of Raft, where blocking due to
slow rangefeed consumers for an unbounded amount of time is unacceptable.
It may require that we resize the processor's input buffer.

A TODO is left about reducing the impact of a single slow consumer
on an entire rangefeed.Processor. This can be left as a future
improvement.

Release note: None

Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
@craig
Copy link
Copy Markdown
Contributor

craig bot commented Aug 27, 2018

Build succeeded

@craig craig bot merged commit 412bb9b into cockroachdb:master Aug 27, 2018
@nvb nvb deleted the nvanbenschoten/rangefeedReleaseValve branch August 27, 2018 12:31
craig bot pushed a commit that referenced this pull request Sep 4, 2018
29500: release-2.1: backport 7 rangefeed PRs r=nvanbenschoten a=nvanbenschoten

Backport:
  * 5/5 commits from "kv: give Transport a haircut" (#28855)
  * 1/1 commits from "engine: use Txn.Timestamp instead of OrigTimestamp for LogLogicalOp" (#28970)
  * 1/1 commits from "rangefeed: add release valve to logical op consumption" (#29076)
  * 3/3 commits from "kv: teach DistSender about RangeFeeds, use for changefeeds" (#28912)
  * 1/1 commits from "rangefeed: small perf-related changes" (#29134)
  * 2/2 commits from "kv: truncate RangeFeed span to range descriptor " (#29219)
  * 2/2 commits from "storage: hook closed timestamps into rangefeed" (#28974)

Please see individual PRs for details.

All cherry-picks were clean.

/cc @cockroachdb/release


Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.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.

3 participants