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

infoschema: keep the timestamp of infoschema v2 updating #52983

Merged
merged 3 commits into from May 8, 2024

Conversation

tiancaiamao
Copy link
Contributor

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
  • 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

@ti-chi-bot ti-chi-bot bot added release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 29, 2024
Copy link

tiprow bot commented Apr 29, 2024

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.

@tiancaiamao tiancaiamao requested review from GMHDBJD, D3Hunter and ywqzzy and removed request for D3Hunter April 29, 2024 09:22
Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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%) ⬆️

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%) ⬆️

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

ti-chi-bot bot commented May 8, 2024

[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

Copy link

ti-chi-bot bot commented May 8, 2024

[LGTM Timeline notifier]

Timeline:

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

@ti-chi-bot ti-chi-bot bot merged commit a177111 into pingcap:master May 8, 2024
21 checks passed
@tiancaiamao tiancaiamao deleted the issue52683 branch May 8, 2024 03:14
terry1purcell pushed a commit to terry1purcell/tidb that referenced this pull request May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

infoschema_v2: panic loadSchemaInLoop
3 participants