Skip to content

Throttler: How does the target-side and source-side components of OnlineDDL request the services of the throttler? #330

Answered by newborn22
newborn22 asked this question in Q&A
Discussion options

You must be logged in to vote

source:

rowStreamer: in streamQuery function

for {
	...
	// check throttler.
	if !rs.vse.throttlerClient.ThrottleCheckOKOrWait(rs.ctx) {
		rs.throttleResponseRateLimiter.Do(func() error {
			return safeSend(&binlogdatapb.VStreamRowsResponse{Throttled: true})
		})
		continue
	}
	...
}

vstreamer: in parseEvents function

for {
	...
	// check throttler.
	if !vs.vse.throttlerClient.ThrottleCheckOKOrWait(ctx) {
		// make sure to leave if context is cancelled
		select {
		case <-ctx.Done():
			return
		default:
			// do nothing special
			throttledHeartbeatsRateLimiter.Do(func() error {
				return injectHeartbeat(true)
		})
		// we won't process events, until we're no longer throttling
		contin…

Replies: 1 comment

Comment options

newborn22
Oct 18, 2023
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by newborn22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant