Skip to content

Commit 9225550

Browse files
committed
puller: fix dead lock
1 parent 0cbb4ff commit 9225550

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

logservice/logpuller/subscription_client.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,13 @@ func (s *SubscriptionClient) onTableDrained(rt *subscribedSpan) {
460460

461461
// Note: don't block the caller, otherwise there may be deadlock
462462
func (s *SubscriptionClient) onRegionFail(errInfo regionErrorInfo) {
463+
// unlock the range early to prevent blocking the range.
464+
if errInfo.subscribedSpan.rangeLock.UnlockRange(
465+
errInfo.span.StartKey, errInfo.span.EndKey,
466+
errInfo.verID.GetID(), errInfo.verID.GetVer(), errInfo.resolvedTs()) {
467+
s.onTableDrained(errInfo.subscribedSpan)
468+
return
469+
}
463470
s.errCache.add(errInfo)
464471
}
465472

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

708715
func (s *SubscriptionClient) doHandleError(ctx context.Context, errInfo regionErrorInfo) error {
709-
if errInfo.subscribedSpan.rangeLock.UnlockRange(
710-
errInfo.span.StartKey, errInfo.span.EndKey,
711-
errInfo.verID.GetID(), errInfo.verID.GetVer(), errInfo.resolvedTs()) {
712-
s.onTableDrained(errInfo.subscribedSpan)
713-
return nil
714-
}
715-
716716
err := errors.Cause(errInfo.err)
717717
switch eerr := err.(type) {
718718
case *eventError:

0 commit comments

Comments
 (0)