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

Support cancel when writing fap snapshots #9415

Merged
merged 58 commits into from
Oct 12, 2024

Conversation

CalvinNeo
Copy link
Member

@CalvinNeo CalvinNeo commented Sep 6, 2024

What problem does this PR solve?

Issue Number: ref #8673

Problem Summary:

Reading through S3 may be time costy. Also:

  1. It could block other normal FAP threads.
  2. It could block blockWaitingFor.

Meanwhile, the whole FastAddPeerWrite function should be guarded with fallback, to avoid any possibility that FAP could block normal path of writing.

What is changed and how it works?

  1. Do not always require a exclusive lock when building end to segment cache, in EndToSegmentId.
  2. Allow cancelling when building cache. Especially when reading segments.
  3. Support cancel when there are too many raft logs in traverseRemoteRaftLogForRegion.
Support cancel in the write stage of FAP snapshots

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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

None

a
Signed-off-by: Calvin Neo <[email protected]>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 6, 2024
a
Signed-off-by: Calvin Neo <[email protected]>
@JinheLin
Copy link
Contributor

image

The fap_context local variable does not used, we can remove it.

Signed-off-by: Calvin Neo <[email protected]>
a
Signed-off-by: Calvin Neo <[email protected]>
@CalvinNeo CalvinNeo changed the title Do not always acquire unique_lock in EndToSegmentId Support cancel when building fap segments and reduce lock level Sep 11, 2024
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 11, 2024
@CalvinNeo
Copy link
Member Author

CalvinNeo commented Sep 23, 2024

/unhold hard to test manually on dedicated disagg mode. merge into tiflash-cse and then test.

Signed-off-by: Calvin Neo <[email protected]>
Signed-off-by: Calvin Neo <[email protected]>
This reverts commit bed9de6.
@CalvinNeo
Copy link
Member Author

/retest

@CalvinNeo
Copy link
Member Author

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 24, 2024
Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

Small code refine

dbms/src/Storages/DeltaMerge/Segment.cpp Outdated Show resolved Hide resolved
dbms/src/Storages/DeltaMerge/Segment.cpp Outdated Show resolved Hide resolved
dbms/src/Storages/StorageDeltaMerge.h Outdated Show resolved Hide resolved
dbms/src/Storages/StorageDeltaMerge.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 12, 2024
Copy link
Contributor

ti-chi-bot bot commented Oct 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, Lloyd-Pottiger

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:
  • OWNERS [JaySon-Huang,Lloyd-Pottiger]

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

Copy link
Contributor

ti-chi-bot bot commented Oct 12, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-14 09:17:45.625306693 +0000 UTC m=+693535.365730629: ☑️ agreed by Lloyd-Pottiger.
  • 2024-10-12 05:52:17.864917507 +0000 UTC m=+77535.013827358: ☑️ agreed by JaySon-Huang.

@ti-chi-bot ti-chi-bot bot merged commit 2e390fc into pingcap:master Oct 12, 2024
5 checks passed
CalvinNeo added a commit to CalvinNeo/tiflash that referenced this pull request Nov 5, 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 Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants