Skip to content

Optimize gc safepoint advancing for internal transaction #32725

@TonsnakeLin

Description

@TonsnakeLin

Enhancement

TiDB advances gc safepoint every tidb_gc_run_interval time with step tidb_gc_life_time. If there is a long time transaction from user client lives more than tidb_gc_life_time, the safpoint can't be advanced until the long transaction is finished or lives than 24h. This mechanism ensures the continuous advancement of gc safepoint and ensures that the data that active transactions need to access will not be cleared.
However, Internal transactions run in TiDB don't comply with the mechanism above. If the internal transaction lives more than tidb_gc_life_time, maybe failed because the data it needs to access was cleared.
Here is an example that an auto analyze task run failed when it lived more than 20 minutes because the data was cleared. The TiDB log printed [tikv:9006]GC life time is shorter than transaction duration, transaction starts at 2021-11-17 14:09:54.756 +0800 CST, GC safe point is 2021-11-17 14:11:54.755 +0800 CST

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions