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

[DNM] refine handle table scan #4674

Closed
wants to merge 12 commits into from
Closed

Conversation

SeaRise
Copy link
Contributor

@SeaRise SeaRise commented Apr 15, 2022

What problem does this PR solve?

Issue Number: ref #4118

Problem Summary:

What is changed and how it works?

  • remove the use of DAGQueryBlock in DAGStorageInterpreter
  • move StorageWithStructureLock(table metadata and table lock) from DAGStorageInterpreter to TiDBStorageTable.

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

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue 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. labels Apr 15, 2022
@SeaRise SeaRise changed the title refine handle table scan [WIP] refine handle table scan Apr 15, 2022
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 15, 2022
@SeaRise
Copy link
Contributor Author

SeaRise commented Apr 15, 2022

/run-integration-test

@SeaRise SeaRise changed the title [WIP] refine handle table scan refine handle table scan Apr 15, 2022
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 15, 2022
@ywqzzy ywqzzy self-requested a review April 18, 2022 13:11
@@ -48,11 +48,12 @@ class TiDBTableScan
}
String getTableScanExecutorID() const
{
return table_scan->executor_id();
return executor_id;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use the table_scan->executor_id() but save a copy of query_block.source_name as the executor_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For coprocess read, table_scan->executor_id() may be empty.
query_block.source_name is guaranteed not to be empty(If executor_id is empty, an id will be assigned).
Would it be better to share the same executor_id for local read and remote read?

dbms/src/Flash/Coprocessor/StorageWithStructureLock.h Outdated Show resolved Hide resolved
dbms/src/Flash/Coprocessor/DAGStorageInterpreter.cpp Outdated Show resolved Hide resolved
@SeaRise
Copy link
Contributor Author

SeaRise commented Apr 20, 2022

/run-integration-test

@SeaRise
Copy link
Contributor Author

SeaRise commented Apr 20, 2022

/run-integration-test

@windtalker
Copy link
Contributor

windtalker commented Apr 21, 2022

This pr locks the table before doing learner read, this is the same as our first implemention, but we met some deadlock related issue, and this pr moved the lock table logical after leaner read is done. So maybe we should not lock the table so early. @JaySon-Huang could you please reconfirm this?

@SeaRise
Copy link
Contributor Author

SeaRise commented Apr 22, 2022

This pr locks the table before doing learner read, this is the same as our first implemention, but we met some deadlock related issue, and this pr moved the lock table logical after leaner read is done. So maybe we should not lock the table so early. @JaySon-Huang could you please reconfirm this?

Maybe I need to move learner read to TiDBStroageTable too

@JaySon-Huang
Copy link
Contributor

JaySon-Huang commented Apr 22, 2022

@SeaRise I prefer to do it this way SeaRise#1

  1. Only gets and locks storage(s) after learner read, and add comments about why
  2. DAGQueryBlockInterpreter does not know about "TiDBStorageTable" except that inside DAGQueryBlockInterpreter::handleTableScan, receive a ptr to take over the locks
  3. Make the ctor of TiDBStorageTable to be more simple, use a static method instead

@SeaRise
Copy link
Contributor Author

SeaRise commented Apr 22, 2022

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 22, 2022
@SeaRise SeaRise changed the title refine handle table scan [WIP] refine handle table scan Apr 22, 2022
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 22, 2022
@SeaRise SeaRise changed the title [WIP] refine handle table scan [DNM] refine handle table scan Apr 24, 2022
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 24, 2022
@SeaRise SeaRise closed this Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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