Skip to content

Partial import during adding index may block GC #62008

Closed

Description

@tangenta

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Add index for a large table, partial import takes a long time:

[INFO] [backend.go:229] ["do a partial import data into the storage"] [category=ddl-ingest]

2. What did you expect to see? (Required)

No warning.

3. What did you see instead (Required)

There are lots of warnings in log:

[txn.go:99] ["An internal transaction running by internal session lasts long time"] [time=12h15m11.5s]

4. What is your TiDB version? (Required)

a268223

Activity

  1. tangenta commented on Jun 25, 2025

    @tangenta
    ContributorAuthor

    Root cause:

    goroutine 42694858340 [select, 753 minutes]:
    github.com/pingcap/tidb/pkg/resourcemanager/pool/workerpool.(*WorkerPool[...]).AddTask(...)
            /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/resourcemanager/pool/workerpool/workerpool.go:161
    github.com/pingcap/tidb/pkg/ddl.scanRecords.func1(0xc0e552a900?)
            /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/ddl/index_cop.go:174 +0x385
    github.com/pingcap/tidb/pkg/ddl.wrapInBeginRollback(0xc0d929ddd0, 0xc0d929dc90)
            /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/ddl/index_cop.go:195 +0xc4
    github.com/pingcap/tidb/pkg/ddl.scanRecords(0xc0d4073200, 0xc0c367e770, 0x13?)
            /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/ddl/index_cop.go:142 +0x210
    github.com/pingcap/tidb/pkg/ddl.(*copReqSender).run(0xc0e760a0e0)
            /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/ddl/index_cop.go:130 +0x4fe
    created by github.com/pingcap/tidb/pkg/ddl.(*copReqSenderPool).adjustSize in goroutine 42694835722
            /home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/pkg/ddl/index_cop.go:229 +0x31
    

    For partial import, the import workers block writers, and the writers block readers.

  2. added a commit that references this issue on Jul 18, 2025
    f253405
  3. added a commit that references this issue on Aug 10, 2025
    cadca9b
  4. added a commit that references this issue on Mar 24, 2026
    bf2f1e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.severity/majortype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions