Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

puller: fix dead lock #1080

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions logservice/logpuller/subscription_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,13 @@ func (s *SubscriptionClient) onTableDrained(rt *subscribedSpan) {

// Note: don't block the caller, otherwise there may be deadlock
func (s *SubscriptionClient) onRegionFail(errInfo regionErrorInfo) {
// unlock the range early to prevent blocking the range.
if errInfo.subscribedSpan.rangeLock.UnlockRange(
errInfo.span.StartKey, errInfo.span.EndKey,
errInfo.verID.GetID(), errInfo.verID.GetVer(), errInfo.resolvedTs()) {
s.onTableDrained(errInfo.subscribedSpan)
return
}
s.errCache.add(errInfo)
}

Expand Down Expand Up @@ -706,13 +713,6 @@ func (s *SubscriptionClient) handleErrors(ctx context.Context) error {
}

func (s *SubscriptionClient) doHandleError(ctx context.Context, errInfo regionErrorInfo) error {
if errInfo.subscribedSpan.rangeLock.UnlockRange(
errInfo.span.StartKey, errInfo.span.EndKey,
errInfo.verID.GetID(), errInfo.verID.GetVer(), errInfo.resolvedTs()) {
s.onTableDrained(errInfo.subscribedSpan)
return nil
}

err := errors.Cause(errInfo.err)
switch eerr := err.(type) {
case *eventError:
Expand Down
Loading