-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
infoschema: add 3 fields to statement summary table #14096
Conversation
/bench |
Benchmark Report
@@ Benchmark Diff @@
================================================================================
--- tidb: 5940bb2ceb7de833839b09341356ef6b0fe38cb7
+++ tidb: fb4d8dbd48b01a9be297e938cc932d332a61ee5d
tikv: 7f17c967ff9d9d778b2c39432cc5465096187261
pd: 8198108644e65c08d6beb7e28ff54ddade5ec542
================================================================================
oltp_update_non_index:
* QPS: 9263.07 ± 0.26% (std=17.85) delta: 0.39% (p=0.378)
* Latency p50: 13.81 ± 0.25% (std=0.03) delta: -0.42%
* Latency p99: 27.66 ± 0.00% (std=0.00) delta: 0.00%
oltp_insert:
* QPS: 4709.87 ± 0.16% (std=5.40) delta: 0.28% (p=0.682)
* Latency p50: 27.17 ± 0.16% (std=0.03) delta: -0.27%
* Latency p99: 46.46 ± 5.92% (std=2.00) delta: -2.16%
oltp_read_write:
* QPS: 16316.36 ± 0.12% (std=12.09) delta: 0.33% (p=0.422)
* Latency p50: 157.27 ± 0.11% (std=0.10) delta: -0.30%
* Latency p99: 316.39 ± 2.39% (std=5.34) delta: 1.22%
oltp_update_index:
* QPS: 4245.43 ± 0.33% (std=10.60) delta: -0.31% (p=0.997)
* Latency p50: 30.15 ± 0.35% (std=0.08) delta: 0.31%
* Latency p99: 54.84 ± 3.56% (std=1.20) delta: -1.19%
oltp_point_select:
* QPS: 41974.43 ± 0.14% (std=41.55) delta: -0.35% (p=0.709)
* Latency p50: 3.05 ± 0.22% (std=0.00) delta: 0.22%
* Latency p99: 9.91 ± 1.82% (std=0.13) delta: 0.00%
|
713e06f
to
c7a869b
Compare
Codecov Report
@@ Coverage Diff @@
## master #14096 +/- ##
===========================================
Coverage ? 80.1793%
===========================================
Files ? 483
Lines ? 121535
Branches ? 0
===========================================
Hits ? 97446
Misses ? 16320
Partials ? 7769 |
infoschema/perfschema/const.go
Outdated
|
||
// tableEventsStatementsSummaryByDigestHistory contains the column name definitions for table | ||
// events_statements_summary_by_digest_history. | ||
const tableEventsStatementsSummaryByDigestHistory = "CREATE TABLE if not exists events_statements_summary_by_digest_history (" + | ||
"SUMMARY_BEGIN_TIME TIMESTAMP(6) NOT NULL," + | ||
"SUMMARY_END_TIME TIMESTAMP(6) NOT NULL," + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use a constant format string to save the create table SQL if the digest
and the history digest
table have the same schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, done.
c7a869b
to
c1d89fa
Compare
key.hash = append(key.hash, hack.Slice(key.digest)...) | ||
key.hash = append(key.hash, hack.Slice(key.schemaName)...) | ||
key.hash = append(key.hash, hack.Slice(key.prevDigest)...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same SQL statement is executed after different statements, the final digest is different? Is it expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, only when current SQL is commit
do we record prevSQL
. Otherwise, prevSQL
is empty. See adaptor.go
.
If all commits are grouped in one record, we can't distinguish different transactions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djshow832 OK, It's a convention of coding and it's better to add some comments to hint the maintainer don't break it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed.
ssElement = ssbd.history.Back().Value.(*stmtSummaryByDigestElement) | ||
c.Assert(ssElement.beginTime, GreaterEqual, now-60) | ||
c.Assert(ssElement.beginTime, LessEqual, now2) | ||
c.Assert(ssElement.endTime-ssElement.beginTime, Equals, int64(60)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to add some cases to test the expiration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestSummaryHistory
tested expiration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset LGTM
Also, please update the Release Notes in your PR Description: list the name of 3 newly added fields and give a brief explanation on why they're added. |
c1d89fa
to
d334aac
Compare
d334aac
to
729e4c4
Compare
LGTM |
/run-unit-test |
/run-all-tests |
What problem does this PR solve?
Add 3 more fields to
events_statements_summary_by_digest
:SUMMARY_END_TIME
: the end time of current summary.SUM_BACKOFF_TIMES
: the total backoff times of this kind of SQL.PREV_SAMPLE_TEXT
: the previous SQL before current SQL if current SQL iscommit
.What is changed and how it works?
SUMMARY_END_TIME
: the end time will change ifrefreshInterval
changes.PREV_SAMPLE_TEXT
: the identifier of each kind of SQL is composed of previous digest and current digest, so it can distinguish different types of transactions.Check List
Tests
Code changes
Side effects
Related changes
Release note
events_statements_summary_by_digest
:SUMMARY_END_TIME
: the end time of current summary.SUM_BACKOFF_TIMES
: the total backoff times of this kind of SQL.PREV_SAMPLE_TEXT
: the previous SQL before current SQL if current SQL iscommit
.