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

storage: Add AddExtraTableIDColumn action and stream #7493

Merged
merged 4 commits into from
May 18, 2023

Conversation

breezewish
Copy link
Member

@breezewish breezewish commented May 18, 2023

What problem does this PR solve?

Issue Number: ref #6827

Problem Summary:

What is changed and how it works?

This PR is extracted from #7457

Change1:

Previously AddExtraTableIDColumn is a single action. Now we also provide a AddExtraTableIDColumnInputStream.

Change2:

Previously we perform AddExtraTableIDColumn inside UnorderedInputStream and DMSegmentThreadInputStream. Now:

  • When ReadThread is not enabled: Apply AddExtraTableIDColumnInputStream after DMSegmentThreadInputStream

  • When ReadThread is enabled: Apply AddExtraTableIDColumnInputStream after SegmentInputStream. This means, UnorderedInputStream will receive blocks with extra table ID column and do nothing but just throwing them out.

This change helps us to support single UnorderedInputStream over multiple partitions, which is a pattern used in disaggregated mode. This pattern is helpful to balance reads from multiple partitions.

TODO: DMSegmentSourceOp is not changed. It still perform AddExtraTableIDColumn inside the operator. After #7480 is merged we could provide AddExtraTableIDColumnOp.

Check List

Tests

  • Unit test - Existing tests
  • Integration test - Existing tests
  • Manual test (add detailed scripts or steps below)

Executed the following SQL when read_thread is on (default) and off:

create table t1(id int, age int, key(id)) partition by range(id) (
  partition p0 values less than (100),
  partition p1 values less than (200),
  partition p2 values less than (300),
  partition p3 values less than (400));

insert into t1 values (1, 10);
insert into t1 values (10, 10);

alter table t1 set tiflash replica 1;

set @@session.tidb_isolation_read_engines='tiflash';
set @@session.tidb_partition_prune_mode = 'dynamic';

analyze table t1;

select * from information_schema.tiflash_replica;

explain select count(*) from t1 where id < 150;

select count(*) from t1 where id < 150;
  • 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
Contributor

ti-chi-bot bot commented May 18, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Lloyd-Pottiger
  • SeaRise

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 bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 18, 2023
@breezewish
Copy link
Member Author

/run-all-tests

Copy link
Contributor

@SeaRise SeaRise 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 the status/LGT1 Indicates that a PR has LGTM 1. label May 18, 2023
@Lloyd-Pottiger
Copy link
Contributor

How about applying AddExtraTableIDColumnInputStream after StorageDeltaMerge::read?

in DAGStorageInterpreter::executeImpl just like executeGeneratedColumnPlaceholder

@breezewish
Copy link
Member Author

How about applying AddExtraTableIDColumnInputStream after StorageDeltaMerge::read?

in DAGStorageInterpreter::executeImpl just like executeGeneratedColumnPlaceholder

@Lloyd-Pottiger Maybe not a good idea, because StorageDisaggregated::read will accept multiple partitions and produce a stream for these partition. In this case, we must ensure the table id column exists to distinguish different partitions. To unify the behavior for disaggregated mode and non-disaggregated mode, we will produce the table id in the ReadThread pool.

@ti-chi-bot ti-chi-bot bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 18, 2023
@breezewish
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented May 18, 2023

@breezewish: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented May 18, 2023

This pull request has been accepted and is ready to merge.

Commit hash: 90e2f60

@ti-chi-bot ti-chi-bot bot added the status/can-merge Indicates a PR has been approved by a committer. label May 18, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented May 18, 2023

@breezewish: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

trigger some heavy tests which will not run always when PR updated.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants