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: Introduce AddExtraTableIDColumnTransformOp #7545

Merged
merged 6 commits into from
May 25, 2023

Conversation

breezewish
Copy link
Member

What problem does this PR solve?

Issue Number: ref #6827

Problem Summary:

What is changed and how it works?

This is the remaining task of #7493, that excluded the AddExtraTableIDColumn logic from SegmentInputStream/SegmentSourceOp.

Check List

Tests

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

Settings:

[profiles.default]
dt_enable_read_thread = false
enable_pipeline = true
enforce_enable_pipeline = true

Query 1 (no partition):

set @@session.tidb_opt_enable_late_materialization = 'off';

/*PLACEHOLDER*/ /*q1*/select   ol_number,
         sum(ol_quantity) as sum_qty,
         sum(ol_amount) as sum_amount,
         avg(ol_quantity) as avg_qty,
         avg(ol_amount) as avg_amount,
         count(*) as count_order
from	 order_line
where	 ol_delivery_d > '2007-01-02 00:00:00.000000'
group by ol_number order by ol_number;

Query 2 (partitioned):

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;

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 25, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • 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 the release-note-none Denotes a PR that doesn't merit a release note. label May 25, 2023
@breezewish breezewish requested review from SeaRise and ywqzzy May 25, 2023 04:25
@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 25, 2023
Signed-off-by: Wish <[email protected]>
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

dbms/src/Operators/AddExtraTableIDColumnTransformOp.h Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the status/LGT1 Indicates that a PR has LGTM 1. label May 25, 2023
@JaySon-Huang
Copy link
Contributor

/rebuild

@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.

Others LGTM

}
}
if (!enable_read_thread)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe

if (enable_read_thread)
{
    for (size_t i = 0; i < final_num_stream; ++i)
    {
        group_builder.addConcurrency(
            std::make_unique<UnorderedSourceOp>(
                exec_status,
                read_task_pool,
                columns_to_read,
                extra_table_id_index,
                log_tracing_id));
    }
}
else
{
    for (size_t i = 0; i < final_num_stream; ++i)
    {
        group_builder.addConcurrency(std::make_unique<DMSegmentThreadSourceOp>(
            exec_status,
            dm_context,
            read_task_pool,
            after_segment_read,
            columns_to_read,
            filter,
            max_version,
            expected_block_size,
            /* read_mode = */ is_fast_scan ? ReadMode::Fast : ReadMode::Normal,
            log_tracing_id));
    }
    group_builder.transform([&](auto & builder) {
        builder.appendTransformOp(std::make_unique<AddExtraTableIDColumnTransformOp>(
            exec_status,
            log_tracing_id,
            columns_to_read,
            extra_table_id_index,
            physical_table_id));
    });
}

is better?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated, PTAL again, thanks!

Signed-off-by: Wish <[email protected]>
@breezewish
Copy link
Member Author

/run-all-tests

@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 25, 2023
@breezewish
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented May 25, 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 25, 2023

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

Commit hash: a4cbe8e

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

ti-chi-bot bot commented May 25, 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.

@ti-chi-bot ti-chi-bot bot merged commit 2513bd4 into pingcap:master May 25, 2023
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/L Denotes a PR that changes 100-499 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