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

executor: subtract the old txn size when track the mem usage (#18000) #18062

Merged
merged 1 commit into from
Jun 17, 2020

Conversation

ti-srebot
Copy link
Contributor

cherry-pick #18000 to release-4.0


What problem does this PR solve?

Issue Number: close #17961

Problem Summary:

What is changed and how it works?

What's Changed:
subtract the old txn size when track the memusage of InsertExec.exec and ReplaceExec.exec

How it Works:

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Manual test (add detailed scripts or steps below)
drop table if exists t2;
create table t2(a int);
insert into t2 values(1), (2), (3);
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;
insert into t2 select * from t2;

set tidb_mem_quota_query=1048576;
select * from t, t2 where t.a=t2.a;

insert into t2 select * from t2;
[2020/06/15 16:08:53.597 +08:00] [INFO] [set.go:207] ["set session var"] [conn=1] [name=tidb_mem_quota_query] [val=3145728]

[2020/06/15 16:08:56.029 +08:00] [WARN] [expensivequery.go:168] [expensive_query] [cost_time=0.404118444s] [stats=t2:417387901159735296] [conn_id=1] [user=root] [database=test] [table_ids="[45]"] [txn_start_ts=417387914362880000] [mem_max="3293321 Bytes (3.1407556533813477 MB)"] [sql="select * from t2"]

[2020/06/15 16:09:06.386 +08:00] [WARN] [expensivequery.go:168] [expensive_query] [cost_time=0.406845733s] [stats=t2:417387901159735296] [conn_id=1] [user=root] [database=test] [table_ids="[45]"] [txn_start_ts=417387917077118976] [mem_max="3293321 Bytes (3.1407556533813477 MB)"] [sql="insert into t2 select * from t2"]

Side effects

N/A

Release note

  • Refine the memory usage counting of InsertExec and ReplaceExec.

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor Author

/run-all-tests

@ti-srebot
Copy link
Contributor Author

@XuHuaiyu please accept the invitation then you can push to the cherry-pick pull requests.
https://github.com/ti-srebot/tidb/invitations

Copy link
Member

@jackysp jackysp 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
Contributor

@lysu lysu left a comment

Choose a reason for hiding this comment

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

LGTM

@lysu
Copy link
Contributor

lysu commented Jun 17, 2020

/run-unit-test

@jackysp jackysp merged commit 2587d60 into pingcap:release-4.0 Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants