tidb icon indicating copy to clipboard operation
tidb copied to clipboard

infoschema: keep the timestamp of infoschema v2 updating

Open tiancaiamao opened this issue 1 year ago • 3 comments

What problem does this PR solve?

Issue Number: close #52683 ref #50959

Problem Summary:

It's casued by compatibility issue between infoschema v2 and GC worker. For infoschema v2, it contains a ts field, SchemaTables and loadTableInfo need this ts to get the corresponding schema meta snapshot.

We store the schemaTS as the ts of an infoschema v2 object in the past.

Whether it's schemaTS or startTS does not matter, because they both use the same schema version and data. But when we're using schemaTS, it's not up to date.

For example, a DDL happened 30 minutes ago. (so the ts of infoschema v2 object is 30 min ago) GC happened 10 minutes ago.

Now we get the infoschema v2 object, and use it, we would get the "GC life time is shorter than transaction duration" error.

What changed and how does it work?

Instead of using schemaTS for infoschema v2 object, we can change to use startTS, and keep the startTS updating in domain load schema loop periodically. So that we can get rid of the "GC life time is shorter than transaction duration" error.

Check List

Tests

  • [ ] Unit test
  • [ ] Integration test
  • [X] Manual test (add detailed scripts or steps below)

Start a cluster and wait for GC, and see no panic. Not easy to do that in unit test because GC is mocked and not really the same as real tikv.

  • [ ] No need to test
    • [ ] I checked and no code files have been changed.

Side effects

  • [ ] Performance regression: Consumes more CPU
  • [ ] Performance regression: Consumes more Memory
  • [ ] Breaking backward compatibility

Documentation

  • [ ] Affects user behaviors
  • [ ] Contains syntax changes
  • [ ] Contains variable changes
  • [ ] Contains experimental features
  • [ ] Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

tiancaiamao avatar Apr 29 '24 09:04 tiancaiamao

Hi @tiancaiamao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tiprow[bot] avatar Apr 29 '24 09:04 tiprow[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 55.8355%. Comparing base (40c81c0) to head (27ec2c8). Report is 39 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #52983         +/-   ##
=================================================
- Coverage   72.3860%   55.8355%   -16.5505%     
=================================================
  Files          1482       1620        +138     
  Lines        428754     615656     +186902     
=================================================
+ Hits         310358     343755      +33397     
- Misses        99088     248679     +149591     
- Partials      19308      23222       +3914     
Flag Coverage Δ
integration 38.0545% <91.6666%> (?)
unit 71.2309% <100.0000%> (+0.0055%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 42.5386% <ø> (+1.3712%) :arrow_up:

codecov[bot] avatar Apr 29 '24 09:04 codecov[bot]

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, ywqzzy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

ti-chi-bot[bot] avatar May 08 '24 02:05 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2024-05-07 10:52:58.138508778 +0000 UTC m=+959331.895644347: :ballot_box_with_check: agreed by GMHDBJD.
  • 2024-05-08 02:23:46.429759537 +0000 UTC m=+1015180.186895286: :ballot_box_with_check: agreed by ywqzzy.

ti-chi-bot[bot] avatar May 08 '24 02:05 ti-chi-bot[bot]