Compare commits

..

26 Commits

Author SHA1 Message Date
Sveta Smirnova
efb402a335 Update .github/workflows/toolkit.yml
Co-authored-by: Artem Gavrilov <artem.gavrilov@percona.com>
2023-06-29 23:30:13 +03:00
Artem Gavrilov
b70977e64d Fix go version 2023-06-29 18:12:07 +02:00
Sveta Smirnova
a2f69927c7 Update toolkit.yml
Bumped Go version to 1.20 for GitHub actions, so it is same as in our build machines.
2023-06-29 18:29:23 +03:00
hanzhongzi
b980c6e149 Fix An error occurred when I migrated... (#614)
HI, i am back
An error occurred when I migrated data from MySQL to OceanBase:【 DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ':= @OLD_SQL_MODE, @@SQL_QUOTE_SHOW_CREATE := @OLD_QUOTE /' at line 1 [for Statement "/!40101 SET @@SQL_MODE := @OLD_SQL_MODE, @@SQL_QUOTE_SHOW_CREATE := @OLD_QUOTE */"] at /usr/bin/pt-archiver line 1932.】

I'm not a Perl programmer. But by reading the source code and making some changes, the migration was done successfully, so I submit this report


- [x] The contributed code is licensed under GPL v2.0
- [x] Contributor Licence Agreement (CLA) is signed
- [x] util/update-modules has been ran
- [x] Not involved Documention updated
- [x] Not involved Test suite update
2023-06-26 14:54:13 +03:00
Sveta Smirnova
25c969542b PT-2151 fix tests for pt-query-digest (#631)
* PT-2151 - Fix tests for pt-query-digest

Put fix for PT-1908 into the proper place

* PT-2151 - Fix tests for pt-query-digest

Put fix for PT-1554 into the proper place

* PT-2151 - Fix tests for pt-query-digest

Adjusted expected results for the default test t/pt-table-checksum/basics.t, so they do not depend on number of rows in the help tables

* PT-2151 - Fix tests for pt-query-digest

Added additional check for both replicas into t/pt-online-schema-change/preserve_triggers.t to avoid deadlock when ->ok() is doing CHECKSUM

* PT-2151 - Fix tests for pt-query-digest

Added delay to t/pt-table-sync/wait.t, so it waits for the child process to start lagging

* PT-2151 - Fix tests for pt-query-digest

Updated t/pt-query-digest/samples/issue_1196-output-8.0.txt, so it reflects changes in the latest 8.0

* PT-2151 - Fix tests for pt-query-digest

Updated queries against query history table, so they don't fail after e2cf183762

* PT-2151 - Fix tests for pt-query-digest

Fixed PT-813 by comparing query text. Since order itself does not matter, it is not essential to compare by the fingerprint or use any other function that changes the query.

* PT-2151 - Fix tests for pt-query-digest

Adjusted samples files which now should have consistent order after fix for PT-813

* PT-2151 - Fix tests for pt-query-digest

Fixed typo in the SELECT query in the QueryReview package

* PT-2151 - Fix tests for pt-query-digest

Fix for PT-981

* PT-2151 - Fix tests for pt-query-digest

Updated modules for pt-index-usage and fixed tests, because checksum is calculated differently after fix for PT-1554

* PT-2151 - Fix tests for pt-query-digest

Updated modules for pt-diskstats, pt-fk-error-logger, pt-heartbeat, pt-online-schema-change, pt-slave-delay, pt-slave-find, pt-table-checksum, pt-table-sync, pt-upgrade

* PT-2151 - Fix tests for pt-query-digest

Updated lib/IndexUsage.pm, so fix for pt-index-usage is in the correct place
2023-06-23 15:48:21 +03:00
Artem Gavrilov
8ef28f7cf8 Merge pull request #643 from percona/dependabot/go_modules/github.com/lib/pq-1.10.9
Bump github.com/lib/pq from 1.10.7 to 1.10.9
2023-06-22 16:56:40 +02:00
Artem Gavrilov
833b1fd4f6 Merge pull request #642 from percona/dependabot/go_modules/github.com/stretchr/testify-1.8.4
Bump github.com/stretchr/testify from 1.8.2 to 1.8.4
2023-06-22 16:56:04 +02:00
dependabot[bot]
62673114f2 Bump github.com/stretchr/testify from 1.8.2 to 1.8.4
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.2 to 1.8.4.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.8.2...v1.8.4)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 14:55:12 +00:00
Artem Gavrilov
0e654e102a Merge pull request #632 from percona/PT-2229_CVE_reported_in_Percona_Toolkit_version_3.5.3_related_to_Logrus
PT-2229 CVE reported in Percona Toolkit version 3.5.3 related to Logrus
2023-06-22 16:54:17 +02:00
dependabot[bot]
46501bed74 Bump github.com/lib/pq from 1.10.7 to 1.10.9
Bumps [github.com/lib/pq](https://github.com/lib/pq) from 1.10.7 to 1.10.9.
- [Release notes](https://github.com/lib/pq/releases)
- [Commits](https://github.com/lib/pq/compare/v1.10.7...v1.10.9)

---
updated-dependencies:
- dependency-name: github.com/lib/pq
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 14:49:42 +00:00
Artem Gavrilov
fc53c3a46b Merge pull request #635 from percona/dependabot/github_actions/aquasecurity/trivy-action-0.11.2
Bump aquasecurity/trivy-action from 0.8.0 to 0.11.2
2023-06-22 16:48:55 +02:00
Artem Gavrilov
3ad5fb3016 Merge pull request #637 from percona/dependabot/go_modules/go.mongodb.org/mongo-driver-1.12.0
Bump go.mongodb.org/mongo-driver from 1.11.3 to 1.12.0
2023-06-22 16:48:34 +02:00
dependabot[bot]
332a29a205 Bump go.mongodb.org/mongo-driver from 1.11.3 to 1.12.0
Bumps [go.mongodb.org/mongo-driver](https://github.com/mongodb/mongo-go-driver) from 1.11.3 to 1.12.0.
- [Release notes](https://github.com/mongodb/mongo-go-driver/releases)
- [Commits](https://github.com/mongodb/mongo-go-driver/compare/v1.11.3...v1.12.0)

---
updated-dependencies:
- dependency-name: go.mongodb.org/mongo-driver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 14:45:55 +00:00
Artem Gavrilov
f269dc712c Merge pull request #636 from percona/dependabot/github_actions/actions/setup-go-4
Bump actions/setup-go from 3 to 4
2023-06-22 16:45:33 +02:00
Artem Gavrilov
404cdb0f54 Merge pull request #638 from percona/dependabot/go_modules/golang.org/x/crypto-0.10.0
Bump golang.org/x/crypto from 0.7.0 to 0.10.0
2023-06-22 16:45:16 +02:00
Artem Gavrilov
28d43ac0ec Merge pull request #639 from percona/dependabot/go_modules/github.com/montanaflynn/stats-0.7.1
Bump github.com/montanaflynn/stats from 0.7.0 to 0.7.1
2023-06-22 16:45:05 +02:00
dependabot[bot]
577b5dedcb Bump golang.org/x/crypto from 0.7.0 to 0.10.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.7.0 to 0.10.0.
- [Commits](https://github.com/golang/crypto/compare/v0.7.0...v0.10.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 14:44:57 +00:00
dependabot[bot]
d1ebb122b4 Bump github.com/montanaflynn/stats from 0.7.0 to 0.7.1
Bumps [github.com/montanaflynn/stats](https://github.com/montanaflynn/stats) from 0.7.0 to 0.7.1.
- [Release notes](https://github.com/montanaflynn/stats/releases)
- [Changelog](https://github.com/montanaflynn/stats/blob/master/CHANGELOG.md)
- [Commits](https://github.com/montanaflynn/stats/compare/v0.7.0...v0.7.1)

---
updated-dependencies:
- dependency-name: github.com/montanaflynn/stats
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 14:44:57 +00:00
dependabot[bot]
cfd5da41bc Bump k8s.io/api from 0.26.3 to 0.27.3 (#640)
Bumps [k8s.io/api](https://github.com/kubernetes/api) from 0.26.3 to 0.27.3.
- [Commits](https://github.com/kubernetes/api/compare/v0.26.3...v0.27.3)

---
updated-dependencies:
- dependency-name: k8s.io/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-22 17:44:29 +03:00
dependabot[bot]
47d2af6cf7 Bump github.com/alecthomas/kong from 0.7.1 to 0.8.0 (#641)
Bumps [github.com/alecthomas/kong](https://github.com/alecthomas/kong) from 0.7.1 to 0.8.0.
- [Commits](https://github.com/alecthomas/kong/compare/v0.7.1...v0.8.0)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/kong
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-22 17:44:13 +03:00
dependabot[bot]
0a42bc6485 Bump actions/setup-go from 3 to 4
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 3 to 4.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 14:39:43 +00:00
dependabot[bot]
ec237548ef Bump aquasecurity/trivy-action from 0.8.0 to 0.11.2
Bumps [aquasecurity/trivy-action](https://github.com/aquasecurity/trivy-action) from 0.8.0 to 0.11.2.
- [Release notes](https://github.com/aquasecurity/trivy-action/releases)
- [Commits](https://github.com/aquasecurity/trivy-action/compare/0.8.0...0.11.2)

---
updated-dependencies:
- dependency-name: aquasecurity/trivy-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-22 14:39:40 +00:00
Artem Gavrilov
9780a01942 Enable dependabot (#634)
* Enable dependabot

* Add CODEOWNERS
2023-06-22 17:39:22 +03:00
Ricardo
01e7b1819e Remove $has_child_tables var (#617)
Remove $has_child_tables check as this seems a duplicate of the check within the alter_fk_method block.
2023-06-21 16:54:22 +03:00
Sveta Smirnova
05e9672f33 PT-2229 CVE reported in Percona Toolkit version 3.5.3 related to Logrus
Bumped version of logrus to 1.9.3
2023-06-20 18:06:22 +03:00
Sveta Smirnova
e998bd5b55 PT-2101 pt-mongodb-query-digest does not work on standalone server (#630)
* PT-2101 - pt-mongodb-query-digest doesn't work on standalone server

Restoring test case, disabled for new sandbox that was never created.
Added debugging output to find out why the tool behaves not as expected.
Most of changes into main.go will be removed after the fix is done.

* PT-2101 - pt-mongodb-query-digest doesn't work on standalone server

- Changed code so it works with the standalone server
- Updated main_test.go so it works for MongoDB 5.0
- Removed eval.js and group.js, because these command are not supported since MongoDB 4.2

* PT-2101 - pt-mongodb-query-digest doesn't work on standalone server

Updated go.mod and go.sum from the 3.x branch
2023-06-14 15:04:57 +03:00
44 changed files with 1202 additions and 1166 deletions

4
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1,4 @@
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
# Order is important; the last matching pattern takes the most precedence.
* @svetasmirnova

11
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
---
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -14,18 +14,16 @@ jobs:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.19
- name: Install make
run: sudo apt-get update && sudo apt-get -y install make
go-version: '1.20'
- name: Build
run: cd src/go; make linux-amd64; cd ../../
- name: Build the Docker image
run: echo "FROM oraclelinux:9-slim" > Dockerfile; echo "COPY bin/* /usr/bin/" >> Dockerfile; docker build . --file Dockerfile --tag percona-toolkit:${{ github.sha }}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.8.0
uses: aquasecurity/trivy-action@0.11.2
with:
image-ref: 'percona-toolkit:${{ github.sha }}'
format: 'table'

View File

@@ -1430,7 +1430,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -2557,7 +2557,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -4278,7 +4278,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -3709,7 +3709,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}
@@ -4919,7 +4919,7 @@ sub save_results {
PTDEBUG && _d("Save query data");
my $insert_query_sth = $dbh->prepare(
"INSERT IGNORE INTO `$db`.`queries` (query_id, fingerprint, sample) "
. " VALUES (CONV(?, 16, 10), ?, ?)");
. " VALUES (?, ?, ?)");
foreach my $query_id ( keys %{$self->{queries}} ) {
my $query = $self->{queries}->{$query_id};
$insert_query_sth->execute(
@@ -4929,7 +4929,7 @@ sub save_results {
PTDEBUG && _d("Saving index usage data");
my $insert_index_usage_sth = $dbh->prepare(
"INSERT INTO `$db`.`index_usage` (query_id, db, tbl, idx, cnt) "
. "VALUES (CONV(?, 16, 10), ?, ?, ?, ?) "
. "VALUES (?, ?, ?, ?, ?) "
. "ON DUPLICATE KEY UPDATE cnt = cnt + ?");
foreach my $query_id ( keys %{$self->{index_usage}} ) {
foreach my $db ( keys %{$self->{index_usage}->{$query_id}} ) {
@@ -4948,7 +4948,7 @@ sub save_results {
my $insert_index_alt_sth = $dbh->prepare(
"INSERT INTO `$db`.`index_alternatives` "
. "(query_id, db, tbl, idx, alt_idx, cnt) "
. "VALUES (CONV(?, 16, 10), ?, ?, ?, ?, ?) "
. "VALUES (?, ?, ?, ?, ?, ?) "
. "ON DUPLICATE KEY UPDATE cnt = cnt + ?");
foreach my $query_id ( keys %{$self->{alt_index_usage}} ) {
foreach my $db ( keys %{$self->{alt_index_usage}->{$query_id}} ) {
@@ -7366,7 +7366,7 @@ MAGIC_create_indexes:
MAGIC_create_queries:
CREATE TABLE IF NOT EXISTS queries (
query_id BIGINT UNSIGNED NOT NULL,
query_id CHAR(32) NOT NULL,
fingerprint TEXT NOT NULL,
sample TEXT NOT NULL,
PRIMARY KEY (query_id)
@@ -7384,7 +7384,7 @@ MAGIC_create_tables:
MAGIC_create_index_usage:
CREATE TABLE IF NOT EXISTS index_usage (
query_id BIGINT UNSIGNED NOT NULL,
query_id CHAR(32) NOT NULL,
db VARCHAR(64) NOT NULL,
tbl VARCHAR(64) NOT NULL,
idx VARCHAR(64) NOT NULL,
@@ -7395,7 +7395,7 @@ MAGIC_create_index_usage:
MAGIC_create_index_alternatives:
CREATE TABLE IF NOT EXISTS index_alternatives (
query_id BIGINT UNSIGNED NOT NULL, -- This query used
query_id CHAR(32) NOT NULL, -- This query used
db VARCHAR(64) NOT NULL, -- this index, but...
tbl VARCHAR(64) NOT NULL, --
idx VARCHAR(64) NOT NULL, --

View File

@@ -2787,7 +2787,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}
@@ -3501,10 +3501,10 @@ sub parse_event {
else {
PTDEBUG && _d('Saving new query, state', $curr->[STATE]);
push @new_cxn, [
@{$curr}[0..7], # proc info
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
@{$curr}[0..7], # proc info
$query_start, # START
$etime, # ETIME
$time, # FSEEN
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
@@ -3515,10 +3515,10 @@ sub parse_event {
if ( $curr->[INFO] && defined $curr->[TIME] ) {
PTDEBUG && _d('Saving query of new cxn, state', $curr->[STATE]);
push @new_cxn, [
@{$curr}[0..7], # proc info
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
@{$curr}[0..7], # proc info
$query_start, # START
$etime, # ETIME
$time, # FSEEN
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}

View File

@@ -6559,7 +6559,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}
@@ -9149,13 +9149,6 @@ sub main {
# ########################################################################
my $child_tables;
my $have_child_tables = find_child_tables(
tbl => $orig_tbl,
Cxn => $cxn,
Quoter => $q,
only_same_schema_fks => $o->get('only-same-schema-fks'),
);
my $vp = VersionParser->new($cxn->dbh());
if (($vp->cmp('8.0.14') >= 0 && $vp->cmp('8.0.17') <= 0) && $vp->flavor() !~ m/maria/i) {
my $msg = "There is an error in MySQL that makes the server to die when trying to ".

View File

@@ -2703,7 +2703,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}
@@ -3394,10 +3394,10 @@ sub parse_event {
else {
PTDEBUG && _d('Saving new query, state', $curr->[STATE]);
push @new_cxn, [
@{$curr}[0..7], # proc info
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
@{$curr}[0..7], # proc info
$query_start, # START
$etime, # ETIME
$time, # FSEEN
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
@@ -3408,10 +3408,10 @@ sub parse_event {
if ( $curr->[INFO] && defined $curr->[TIME] ) {
PTDEBUG && _d('Saving query of new cxn, state', $curr->[STATE]);
push @new_cxn, [
@{$curr}[0..7], # proc info
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
@{$curr}[0..7], # proc info
$query_start, # START
$etime, # ETIME
$time, # FSEEN
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
@@ -5892,7 +5892,10 @@ sub top_events {
my ( $self, %args ) = @_;
my $classes = $self->{result_classes};
my @sorted = reverse sort { # Sorted list of $groupby values
$classes->{$a}->{$args{attrib}}->{$args{orderby}}
($classes->{$a}->{$args{attrib}}->{$args{orderby}}
== $classes->{$b}->{$args{attrib}}->{$args{orderby}})
? $a cmp $b
: $classes->{$a}->{$args{attrib}}->{$args{orderby}}
<=> $classes->{$b}->{$args{attrib}}->{$args{orderby}}
} grep {
defined $classes->{$_}->{$args{attrib}}->{$args{orderby}}
@@ -7386,7 +7389,7 @@ sub profile {
$report->title('Profile');
my @cols = (
{ name => 'Rank', right_justify => 1, },
{ name => 'Query ID', },
{ name => 'Query ID', width => 35 },
{ name => 'Response time', right_justify => 1, },
{ name => 'Calls', right_justify => 1, },
{ name => 'R/Call', right_justify => 1, },
@@ -9264,7 +9267,7 @@ sub new {
my $sql = <<" SQL";
INSERT INTO $args{db_tbl}
(checksum, fingerprint, sample, first_seen, last_seen)
VALUES(CONV(?, 16, 10), ?, ?, COALESCE(?, $now), COALESCE(?, $now))
VALUES(?, ?, ?, COALESCE(?, $now), COALESCE(?, $now))
ON DUPLICATE KEY UPDATE
first_seen = IF(
first_seen IS NULL,
@@ -9281,8 +9284,8 @@ sub new {
my @review_cols = grep { !$skip_cols{$_} } @{$args{tbl_struct}->{cols}};
$sql = "SELECT "
. join(', ', map { $args{quoter}->quote($_) } @review_cols)
. ", CONV(checksum, 10, 16) AS checksum_conv FROM $args{db_tbl}"
. " WHERE checksum=CONV(?, 16, 10)";
. ", checksum AS checksum_conv FROM $args{db_tbl}"
. " WHERE checksum=?";
PTDEBUG && _d('SQL to select from review table:', $sql);
my $select_sth = $args{dbh}->prepare($sql);
@@ -9412,7 +9415,7 @@ sub set_history_options {
my $sql = "REPLACE INTO $args{table}("
. join(', ',
map { Quoter->quote($_) } ('checksum', 'sample', @cols))
. ') VALUES (CONV(?, 16, 10), ?'
. ') VALUES (?, ?'
. (@cols ? ', ' : '') # issue 1265
. join(', ', map {
$_ eq 'ts_min' || $_ eq 'ts_max'

View File

@@ -2780,7 +2780,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -3736,7 +3736,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -8391,7 +8391,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -8431,7 +8431,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -2976,7 +2976,7 @@ sub any_unix_timestamp {
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

26
go.mod
View File

@@ -6,26 +6,26 @@ require (
github.com/AlekSi/pointer v1.2.0
github.com/Masterminds/semver v1.5.0
github.com/alecthomas/kingpin v2.2.6+incompatible
github.com/alecthomas/kong v0.7.1
github.com/alecthomas/kong v0.8.0
github.com/go-ini/ini v1.67.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
github.com/hashicorp/go-version v1.6.0
github.com/howeyc/gopass v0.0.0-20210920133722-c8aef6fb66ef
github.com/lib/pq v1.10.7
github.com/lib/pq v1.10.9
github.com/mattn/go-shellwords v1.0.12
github.com/montanaflynn/stats v0.7.0
github.com/montanaflynn/stats v0.7.1
github.com/pborman/getopt v1.1.0
github.com/percona/go-mysql v0.0.0-20210427141028-73d29c6da78c
github.com/pkg/errors v0.9.1
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/sirupsen/logrus v1.9.2
github.com/stretchr/testify v1.8.2
go.mongodb.org/mongo-driver v1.11.3
golang.org/x/crypto v0.7.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
go.mongodb.org/mongo-driver v1.12.0
golang.org/x/crypto v0.10.0
golang.org/x/exp v0.0.0-20230321023759-10a507213a29
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
k8s.io/api v0.26.3
k8s.io/api v0.27.3
)
require (
@@ -49,15 +49,15 @@ require (
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/term v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.26.3 // indirect
k8s.io/apimachinery v0.27.3 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect

74
go.sum
View File

@@ -5,8 +5,8 @@ github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0
github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0=
github.com/alecthomas/kingpin v2.2.6+incompatible h1:5svnBTFgJjZvGKyYBtMB0+m5wvrbUHiqye8wRJMlnYI=
github.com/alecthomas/kingpin v2.2.6+incompatible/go.mod h1:59OFYbFVLKQKq+mqrL6Rw5bR0c3ACQaawgXx0QYndlE=
github.com/alecthomas/kong v0.7.1 h1:azoTh0IOfwlAX3qN9sHWTxACE2oV8Bg2gAwBsMwDQY4=
github.com/alecthomas/kong v0.7.1/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
github.com/alecthomas/kong v0.8.0 h1:ryDCzutfIqJPnNn0omnrgHLbAggDQM2VWHikE1xqK7s=
github.com/alecthomas/kong v0.8.0/go.mod h1:n1iCIO2xS46oE8ZfYCNDqdR0b0wZNrXAIAqro/2132U=
github.com/alecthomas/repr v0.1.0 h1:ENn2e1+J3k09gyj2shc0dHr/yjaWSHRlrJ4DPMevDqE=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@@ -48,13 +48,10 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw=
github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -63,9 +60,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/montanaflynn/stats v0.7.0 h1:r3y12KyNxj/Sb/iOE46ws+3mS1+MZca1wlHQFPsY/JU=
github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
github.com/pborman/getopt v1.1.0 h1:eJ3aFZroQqq0bWmraivjQNt6Dmm5M0h2JcDW38/Azb0=
github.com/pborman/getopt v1.1.0/go.mod h1:FxXoW1Re00sQG/+KIkuSqRL/LwQgSkv7uyac+STFsbk=
github.com/percona/go-mysql v0.0.0-20210427141028-73d29c6da78c h1:1SZ7nS+kSaO63IpaKspf/gf8602QcgP2eXNPMNOIc0M=
@@ -74,36 +70,26 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y=
github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms=
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
github.com/xdg-go/scram v1.1.2/go.mod h1:RT/sEzTbU5y00aCK8UOx6R7YryM0iF1N2MOmC3kKLN4=
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
github.com/xdg-go/stringprep v1.0.4 h1:XLI/Ng3O1Atzq0oBs3TWm+5ZVgkq2aqdlvP9JtoZ6c8=
github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gijq1dTyGkM=
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA=
@@ -115,16 +101,16 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.mongodb.org/mongo-driver v1.11.3 h1:Ql6K6qYHEzB6xvu4+AU0BoRoqf9vFPcc4o7MUIdPW8Y=
go.mongodb.org/mongo-driver v1.11.3/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE=
go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM=
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -139,8 +125,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -161,19 +147,20 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28=
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.10.0 h1:UpjohKhiEgNc0CSauXmwYftY1+LlaC75SJwh0SgCX58=
golang.org/x/text v0.10.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
@@ -185,8 +172,7 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
@@ -198,10 +184,10 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
k8s.io/api v0.26.3 h1:emf74GIQMTik01Aum9dPP0gAypL8JTLl/lHa4V9RFSU=
k8s.io/api v0.26.3/go.mod h1:PXsqwPMXBSBcL1lJ9CYDKy7kIReUydukS5JiRlxC3qE=
k8s.io/apimachinery v0.26.3 h1:dQx6PNETJ7nODU3XPtrwkfuubs6w7sX0M8n61zHIV/k=
k8s.io/apimachinery v0.26.3/go.mod h1:ats7nN1LExKHvJ9TmwootT00Yz05MuYqPXEXaVeOy5I=
k8s.io/api v0.27.3 h1:yR6oQXXnUEBWEWcvPWS0jQL575KoAboQPfJAuKNrw5Y=
k8s.io/api v0.27.3/go.mod h1:C4BNvZnQOF7JA/0Xed2S+aUyJSfTGkGFxLXz9MnpIpg=
k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM=
k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E=
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 h1:xMMXJlJbsU8w3V5N2FLDQ8YgU8s1EoULdbQBcAeNJkY=

View File

@@ -795,7 +795,10 @@ sub top_events {
my ( $self, %args ) = @_;
my $classes = $self->{result_classes};
my @sorted = reverse sort { # Sorted list of $groupby values
$classes->{$a}->{$args{attrib}}->{$args{orderby}}
($classes->{$a}->{$args{attrib}}->{$args{orderby}}
== $classes->{$b}->{$args{attrib}}->{$args{orderby}})
? $a cmp $b
: $classes->{$a}->{$args{attrib}}->{$args{orderby}}
<=> $classes->{$b}->{$args{attrib}}->{$args{orderby}}
} grep {
# Defensive programming

View File

@@ -262,7 +262,7 @@ sub save_results {
PTDEBUG && _d("Save query data");
my $insert_query_sth = $dbh->prepare(
"INSERT IGNORE INTO `$db`.`queries` (query_id, fingerprint, sample) "
. " VALUES (CONV(?, 16, 10), ?, ?)");
. " VALUES (?, ?, ?)");
foreach my $query_id ( keys %{$self->{queries}} ) {
my $query = $self->{queries}->{$query_id};
$insert_query_sth->execute(
@@ -272,7 +272,7 @@ sub save_results {
PTDEBUG && _d("Saving index usage data");
my $insert_index_usage_sth = $dbh->prepare(
"INSERT INTO `$db`.`index_usage` (query_id, db, tbl, idx, cnt) "
. "VALUES (CONV(?, 16, 10), ?, ?, ?, ?) "
. "VALUES (?, ?, ?, ?, ?) "
. "ON DUPLICATE KEY UPDATE cnt = cnt + ?");
foreach my $query_id ( keys %{$self->{index_usage}} ) {
foreach my $db ( keys %{$self->{index_usage}->{$query_id}} ) {
@@ -291,7 +291,7 @@ sub save_results {
my $insert_index_alt_sth = $dbh->prepare(
"INSERT INTO `$db`.`index_alternatives` "
. "(query_id, db, tbl, idx, alt_idx, cnt) "
. "VALUES (CONV(?, 16, 10), ?, ?, ?, ?, ?) "
. "VALUES (?, ?, ?, ?, ?, ?) "
. "ON DUPLICATE KEY UPDATE cnt = cnt + ?");
foreach my $query_id ( keys %{$self->{alt_index_usage}} ) {
foreach my $db ( keys %{$self->{alt_index_usage}->{$query_id}} ) {

View File

@@ -302,10 +302,10 @@ sub parse_event {
else {
PTDEBUG && _d('Saving new query, state', $curr->[STATE]);
push @new_cxn, [
@{$curr}[0..7], # proc info
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
@{$curr}[0..7], # proc info
$query_start, # START
$etime, # ETIME
$time, # FSEEN
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
@@ -317,10 +317,10 @@ sub parse_event {
# But only save the new cxn if it's executing.
PTDEBUG && _d('Saving query of new cxn, state', $curr->[STATE]);
push @new_cxn, [
@{$curr}[0..7], # proc info
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
@{$curr}[0..7], # proc info
$query_start, # START
$etime, # ETIME
$time, # FSEEN
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}

View File

@@ -98,7 +98,7 @@ sub set_history_options {
my $sql = "REPLACE INTO $args{table}("
. join(', ',
map { Quoter->quote($_) } ('checksum', 'sample', @cols))
. ') VALUES (CONV(?, 16, 10), ?'
. ') VALUES (?, ?'
. (@cols ? ', ' : '') # issue 1265
. join(', ', map {
# ts_min and ts_max might be part of the PK, in which case they must

View File

@@ -876,7 +876,7 @@ sub profile {
$report->title('Profile');
my @cols = (
{ name => 'Rank', right_justify => 1, },
{ name => 'Query ID', },
{ name => 'Query ID', width => 35 },
{ name => 'Response time', right_justify => 1, },
{ name => 'Calls', right_justify => 1, },
{ name => 'R/Call', right_justify => 1, },

View File

@@ -71,7 +71,7 @@ sub new {
my $sql = <<" SQL";
INSERT INTO $args{db_tbl}
(checksum, fingerprint, sample, first_seen, last_seen)
VALUES(CONV(?, 16, 10), ?, ?, COALESCE(?, $now), COALESCE(?, $now))
VALUES(?, ?, ?, COALESCE(?, $now), COALESCE(?, $now))
ON DUPLICATE KEY UPDATE
first_seen = IF(
first_seen IS NULL,
@@ -90,8 +90,8 @@ sub new {
my @review_cols = grep { !$skip_cols{$_} } @{$args{tbl_struct}->{cols}};
$sql = "SELECT "
. join(', ', map { $args{quoter}->quote($_) } @review_cols)
. ", CONV(checksum, 10, 16) AS checksum_conv FROM $args{db_tbl}"
. " WHERE checksum=CONV(?, 16, 10)";
. ", checksum AS checksum_conv FROM $args{db_tbl}"
. " WHERE checksum=?";
PTDEBUG && _d('SQL to select from review table:', $sql);
my $select_sth = $args{dbh}->prepare($sql);

View File

@@ -94,14 +94,16 @@ sub get_create_table {
if ( my $e = $EVAL_ERROR ) {
# Restore old SQL mode.
PTDEBUG && _d($old_sql_mode);
$dbh->do($old_sql_mode);
eval { $dbh->do($old_sql_mode); };
PTDEBUG && $EVAL_ERROR && _d($EVAL_ERROR);
die $e;
}
# Restore old SQL mode.
PTDEBUG && _d($old_sql_mode);
$dbh->do($old_sql_mode);
eval { $dbh->do($old_sql_mode); };
PTDEBUG && $EVAL_ERROR && _d($EVAL_ERROR);
# SHOW CREATE TABLE has at least 2 columns like:
# mysql> show create table city\G

View File

@@ -272,7 +272,7 @@ sub any_unix_timestamp {
# Returns the rightmost 64 bits of an MD5 checksum of the value.
sub make_checksum {
my ( $val ) = @_;
my $checksum = uc substr(md5_hex($val), -16);
my $checksum = uc md5_hex($val);
PTDEBUG && _d($checksum, 'checksum for', $val);
return $checksum;
}

View File

@@ -25,18 +25,18 @@ import (
)
// Enable enabled the mongo profiler
func Enable(ctx context.Context, client *mongo.Client) error {
res := client.Database("admin").RunCommand(ctx, primitive.M{"profile": 2})
func Enable(ctx context.Context, client *mongo.Client, database string) error {
res := client.Database(database).RunCommand(ctx, primitive.M{"profile": 2})
return res.Err()
}
// Disable disables the mongo profiler
func Disable(ctx context.Context, client *mongo.Client) error {
res := client.Database("admin").RunCommand(ctx, primitive.M{"profile": 0})
func Disable(ctx context.Context, client *mongo.Client, database string) error {
res := client.Database(database).RunCommand(ctx, primitive.M{"profile": 0})
return res.Err()
}
// Drop drops the system.profile collection for clean up
func Drop(ctx context.Context, client *mongo.Client) error {
return client.Database("").Collection("system.profile").Drop(ctx)
func Drop(ctx context.Context, client *mongo.Client, database string) error {
return client.Database(database).Collection("system.profile").Drop(ctx)
}

View File

@@ -156,6 +156,10 @@ func (f *Fingerprinter) Fingerprint(doc proto.SystemProfile) (Fingerprint, error
op = "eval"
collection = ""
retKeys = []string{}
case "drop":
retKeys = []string{}
case "createIndexes":
retKeys = []string{}
}
default:
op = doc.Op
@@ -177,7 +181,6 @@ func (f *Fingerprinter) Fingerprint(doc proto.SystemProfile) (Fingerprint, error
if keys != "" {
parts = append(parts, keys)
}
ns = []string{}
if database != "" {
ns = append(ns, database)

View File

@@ -138,7 +138,7 @@ func (p *Profile) getDocs(ctx context.Context) {
for _, filter := range p.filters {
if !filter(doc) {
valid = false
return
break
}
}
if !valid {

View File

@@ -4,6 +4,7 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"os"
"sort"
@@ -133,7 +134,7 @@ func main() {
log.Fatalf("Cannot connect to MongoDB: %s", err)
}
isProfilerEnabled, err := isProfilerEnabled(ctx, clientOptions)
isProfilerEnabled, err := isProfilerEnabled(ctx, clientOptions, opts.Database)
if err != nil {
log.Errorf("Cannot get profiler status: %s", err.Error())
os.Exit(4)
@@ -523,19 +524,37 @@ func sortQueries(queries []stats.QueryStats, orderby []string) []stats.QueryStat
return queries
}
func isProfilerEnabled(ctx context.Context, clientOptions *options.ClientOptions) (bool, error) {
func isProfilerEnabled(ctx context.Context, clientOptions *options.ClientOptions, dbname string) (bool, error) {
var ps proto.ProfilerStatus
replicaMembers, err := util.GetReplicasetMembers(ctx, clientOptions)
if err != nil {
if err != nil && !errors.Is(err, util.ShardingNotEnabledError) {
return false, err
}
if len(replicaMembers) == 0 {
client, err := mongo.NewClient(clientOptions)
if err != nil {
return false, err
}
if err = client.Connect(ctx); err != nil {
return false, err
}
client.Database(dbname).RunCommand(ctx, primitive.M{"profile": -1}).Decode(&ps)
if ps.Was == 0 {
return false, nil
}
}
for _, member := range replicaMembers {
// Stand alone instances return state = REPLICA_SET_MEMBER_STARTUP
client, err := util.GetClientForHost(clientOptions, member.Name)
if err != nil {
continue
}
if err := client.Connect(ctx); err != nil {
log.Fatalf("Cannot connect to MongoDB: %s", err)
}
isReplicaEnabled := isReplicasetEnabled(ctx, client)
@@ -546,7 +565,7 @@ func isProfilerEnabled(ctx context.Context, clientOptions *options.ClientOptions
if isReplicaEnabled && member.State != proto.REPLICA_SET_MEMBER_PRIMARY {
continue
}
if err := client.Database("admin").RunCommand(ctx, primitive.M{"profile": -1}).Decode(&ps); err != nil {
if err := client.Database(dbname).RunCommand(ctx, primitive.M{"profile": -1}).Decode(&ps); err != nil {
continue
}

View File

@@ -1,475 +1,502 @@
package main
// TODO: Rewrite tests to use the new sandbox
import (
"bufio"
"bytes"
"context"
"fmt"
"io/ioutil"
"log"
"os"
"os/exec"
"reflect"
"regexp"
"runtime"
"sort"
"strings"
"testing"
"text/template"
"time"
// const (
// samples = "/src/go/tests/"
// )
//
// type testVars struct {
// RootPath string
// }
//
// var vars testVars
// var Server dbtest.DBServer
//
// func TestMain(m *testing.M) {
// var err error
// if vars.RootPath, err = tutil.RootPath(); err != nil {
// log.Printf("cannot get root path: %s", err.Error())
// os.Exit(1)
// }
// os.Exit(m.Run())
//
// // The tempdir is created so MongoDB has a location to store its files.
// // Contents are wiped once the server stops
// os.Setenv("CHECK_SESSIONS", "0")
// tempDir, _ := ioutil.TempDir("", "testing")
// Server.SetPath(tempDir)
//
// retCode := m.Run()
//
// Server.Session().Close()
// Server.Session().DB("samples").DropDatabase()
//
// // Stop shuts down the temporary server and removes data on disk.
// Server.Stop()
//
// // call with result of m.Run()
// os.Exit(retCode)
// }
//
// func TestIsProfilerEnabled(t *testing.T) {
// mongoDSN := os.Getenv("PT_TEST_MONGODB_DSN")
// if mongoDSN == "" {
// t.Skip("Skippping TestIsProfilerEnabled. It runs only in integration tests")
// }
//
// dialer := pmgo.NewDialer()
// di, _ := pmgo.ParseURL(mongoDSN)
//
// enabled, err := isProfilerEnabled(dialer, di)
//
// if err != nil {
// t.Errorf("Cannot check if profiler is enabled: %s", err.Error())
// }
// if enabled != true {
// t.Error("Profiler must be enabled")
// }
//
// }
//
// func TestParseArgs(t *testing.T) {
// tests := []struct {
// args []string
// want *options
// }{
// {
// args: []string{TOOLNAME}, // arg[0] is the command itself
// want: &options{
// Host: DEFAULT_HOST,
// LogLevel: DEFAULT_LOGLEVEL,
// OrderBy: strings.Split(DEFAULT_ORDERBY, ","),
// SkipCollections: strings.Split(DEFAULT_SKIPCOLLECTIONS, ","),
// AuthDB: DEFAULT_AUTHDB,
// OutputFormat: "text",
// },
// },
// {
// args: []string{TOOLNAME, "zapp.brannigan.net:27018/samples", "--help"},
// want: nil,
// },
// {
// args: []string{TOOLNAME, "zapp.brannigan.net:27018/samples"},
// want: &options{
// Host: "zapp.brannigan.net:27018/samples",
// LogLevel: DEFAULT_LOGLEVEL,
// OrderBy: strings.Split(DEFAULT_ORDERBY, ","),
// SkipCollections: strings.Split(DEFAULT_SKIPCOLLECTIONS, ","),
// AuthDB: DEFAULT_AUTHDB,
// Help: false,
// OutputFormat: "text",
// },
// },
// }
// for i, test := range tests {
// getopt.Reset()
// os.Args = test.args
// got, err := getOptions()
// if err != nil {
// t.Errorf("error parsing command line arguments: %s", err.Error())
// }
// if !reflect.DeepEqual(got, test.want) {
// t.Errorf("invalid command line options test %d\ngot %+v\nwant %+v\n", i, got, test.want)
// }
// }
//
// }
//
// type Data struct {
// bin string
// url string
// }
//
// func TestPTMongoDBQueryDigest(t *testing.T) {
// var err error
//
// binDir, err := ioutil.TempDir("/tmp", "pmm-client-test-bindir-")
// if err != nil {
// t.Error(err)
// }
// defer func() {
// err := os.RemoveAll(binDir)
// if err != nil {
// t.Error(err)
// }
// }()
//
// bin := binDir + "/pt-mongodb-query-digest"
// xVariables := map[string]string{
// "main.Build": "<Build>",
// "main.Version": "<Version>",
// "main.GoVersion": "<GoVersion>",
// }
// var ldflags []string
// for x, value := range xVariables {
// ldflags = append(ldflags, fmt.Sprintf("-X %s=%s", x, value))
// }
// cmd := exec.Command(
// "go",
// "build",
// "-o",
// bin,
// "-ldflags",
// strings.Join(ldflags, " "),
// )
// cmd.Stdout = os.Stdout
// cmd.Stderr = os.Stderr
// err = cmd.Run()
// if err != nil {
// t.Error(err)
// }
//
// data := Data{
// bin: bin,
// }
// tests := []func(*testing.T, Data){
// testVersion,
// testEmptySystemProfile,
// testAllOperationsTemplate,
// }
// t.Run("pmm-admin", func(t *testing.T) {
// for _, f := range tests {
// f := f // capture range variable
// fName := runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()
// t.Run(fName, func(t *testing.T) {
// // Clean up system.profile
// var err error
// data.url = "127.0.0.1/test"
// err = profiling.Disable(data.url)
// if err != nil {
// t.Error(err)
// }
// profiling.Drop(data.url)
// err = profiling.Enable(data.url)
// if err != nil {
// t.Error(err)
// }
// defer profiling.Disable(data.url)
//
// // t.Parallel()
// f(t, data)
// })
// }
// })
//
// }
//
// func testVersion(t *testing.T, data Data) {
// cmd := exec.Command(
// data.bin,
// "--version",
// )
// output, err := cmd.CombinedOutput()
// if err != nil {
// t.Error(err)
// }
// expected := `pt-mongodb-query-digest
// Version <Version>
// Build: <Build> using <GoVersion>`
//
// assertRegexpLines(t, expected, string(output))
// }
//
// func testEmptySystemProfile(t *testing.T, data Data) {
// cmd := exec.Command(
// data.bin,
// data.url,
// )
// output, err := cmd.CombinedOutput()
// if err != nil {
// t.Error(err)
// }
//
// expected := "No queries found in profiler information for database \\\"test\\\""
// if !strings.Contains(string(output), expected) {
// t.Errorf("Empty system.profile.\nGot:\n%s\nWant:\n%s\n", string(output), expected)
// }
// }
//
// func testAllOperationsTemplate(t *testing.T, data Data) {
// dir := vars.RootPath + samples + "/doc/script/profile/"
// files, err := ioutil.ReadDir(dir)
// if err != nil {
// t.Fatalf("cannot list samples: %s", err)
// }
//
// fs := []string{}
// for _, file := range files {
// fs = append(fs, dir+file.Name())
// }
// sort.Strings(fs)
// err = run(fs...)
// if err != nil {
// t.Fatalf("cannot execute queries: %s", err)
// }
//
// // disable profiling so pt-mongodb-query digest reads rows from `system.profile`
// profiling.Disable(data.url)
//
// // run profiler
// cmd := exec.Command(
// data.bin,
// data.url,
// )
//
// output, err := cmd.CombinedOutput()
// if err != nil {
// t.Error(err)
// }
//
// queries := []stats.QueryStats{
// {
// ID: "e357abe482dcc0cd03ab742741bf1c86",
// Namespace: "test.coll",
// Operation: "INSERT",
// Fingerprint: "INSERT coll",
// },
// {
// ID: "c9b40ce564762834d12b0390a292645c",
// Namespace: "test.coll",
// Operation: "DROP",
// Fingerprint: "DROP coll drop",
// },
// {
// ID: "db759bfd83441deecc71382323041ce6",
// Namespace: "test.coll",
// Operation: "GETMORE",
// Fingerprint: "GETMORE coll",
// },
// {
// ID: "e72ad41302045bd6c2bcad76511f915a",
// Namespace: "test.coll",
// Operation: "REMOVE",
// Fingerprint: "REMOVE coll a,b",
// },
// {
// ID: "30dbfbc89efd8cfd40774dff0266a28f",
// Namespace: "test.coll",
// Operation: "AGGREGATE",
// Fingerprint: "AGGREGATE coll a",
// },
// {
// ID: "a6782ae38ef891d5506341a4b0ab2747",
// Namespace: "test",
// Operation: "EVAL",
// Fingerprint: "EVAL",
// },
// {
// ID: "76d7662df07b44135ac3e07e44a6eb39",
// Namespace: "",
// Operation: "EXPLAIN",
// Fingerprint: "EXPLAIN",
// },
// {
// ID: "e8a3f05a4bd3f0bfa7d38eb2372258b1",
// Namespace: "test.coll",
// Operation: "FINDANDMODIFY",
// Fingerprint: "FINDANDMODIFY coll a",
// },
// {
// ID: "2a639e77efe3e68399ef9482575b3421",
// Namespace: "test.coll",
// Operation: "FIND",
// Fingerprint: "FIND coll",
// },
// {
// ID: "fe0bf975a044fe47fd32b835ceba612d",
// Namespace: "test.coll",
// Operation: "FIND",
// Fingerprint: "FIND coll a",
// },
// {
// ID: "20fe80188ec82c9d3c3dcf3f4817f8f9",
// Namespace: "test.coll",
// Operation: "FIND",
// Fingerprint: "FIND coll b,c",
// },
// {
// ID: "02104210d67fe680273784d833f86831",
// Namespace: "test.coll",
// Operation: "FIND",
// Fingerprint: "FIND coll c,k,pad",
// },
// {
// ID: "5efe4738d807c74b3980de76c37a0870",
// Namespace: "test.coll",
// Operation: "FIND",
// Fingerprint: "FIND coll k",
// },
// {
// ID: "798d7c1cd25b63cb6a307126a25910d6",
// Namespace: "test.system.js",
// Operation: "FIND",
// Fingerprint: "FIND system.js",
// },
// {
// ID: "c70403cbd55ffbb07f08c0cb77a24b19",
// Namespace: "test.coll",
// Operation: "GEONEAR",
// Fingerprint: "GEONEAR coll",
// },
// {
// ID: "e4122a58c99ab0a4020ce7d195c5a8cb",
// Namespace: "test.coll",
// Operation: "DISTINCT",
// Fingerprint: "DISTINCT coll a,b",
// },
// {
// ID: "ca8bb19386488570447f5753741fb494",
// Namespace: "test.coll",
// Operation: "GROUP",
// Fingerprint: "GROUP coll a,b",
// },
// {
// ID: "10b8f47b366fbfd1fb01f8d17d75b1a2",
// Namespace: "test.coll",
// Operation: "COUNT",
// Fingerprint: "COUNT coll a",
// },
// {
// ID: "cc3cb3824eea4094eb042f5ca76bd385",
// Namespace: "test.coll",
// Operation: "MAPREDUCE",
// Fingerprint: "MAPREDUCE coll a",
// },
// {
// ID: "cba2dff0740762c6e5769f0e300df676",
// Namespace: "test.coll",
// Operation: "COUNT",
// Fingerprint: "COUNT coll",
// },
// {
// ID: "f74a5120ac22d02120ccbf6d478b0dbc",
// Namespace: "test.coll",
// Operation: "UPDATE",
// Fingerprint: "UPDATE coll a",
// },
// }
//
// expected := `Profiler is disabled for the "test" database but there are \s*[0-9]+ documents in the system.profile collection.
// Using those documents for the stats
//
// # Totals
// # Ratio [0-9\.]+ \(docs scanned/returned\)
// # Attribute pct total min max avg 95% stddev median
// # ================== === ======== ======== ======== ======== ======== ======= ========
// # Count \(docs\) (\s*[0-9]+)\s
// # Exec Time ms (\s*[0-9]+){8}\s
// # Docs Scanned (\s*[0-9\.]+){8}\s
// # Docs Returned (\s*[0-9\.]+){8}\s
// # Bytes sent (\s*[0-9\.K]+){8}(K|\s)
// #\s
// `
//
// queryTpl := `
// # Query [0-9]+: [0-9\.]+ QPS, ID {{.ID}}
// # Ratio [0-9\.]+ \(docs scanned/returned\)
// # Time range: .* to .*
// # Attribute pct total min max avg 95% stddev median
// # ================== === ======== ======== ======== ======== ======== ======= ========
// # Count \(docs\) (\s*[0-9]+)\s
// # Exec Time ms (\s*[0-9]+){8}\s
// # Docs Scanned (\s*[0-9\.]+){8}\s
// # Docs Returned (\s*[0-9\.]+){8}\s
// # Bytes sent (\s*[0-9\.K]+){8}(K|\s)
// # String:
// # Namespace {{.Namespace}}
// # Operation {{.Operation}}
// # Fingerprint {{.Fingerprint}}
// # Query .*
//
// `
//
// tpl, _ := template.New("query").Parse(queryTpl)
// for _, query := range queries {
// buf := bytes.Buffer{}
// err := tpl.Execute(&buf, query)
// if err != nil {
// t.Error(err)
// }
//
// expected += buf.String()
// }
// expected += "\n" // Looks like we expect additional line
//
// assertRegexpLines(t, expected, string(output))
// }
//
// // assertRegexpLines matches regexp line by line to corresponding line of text
// func assertRegexpLines(t *testing.T, rx string, str string, msgAndArgs ...interface{}) bool {
// expectedScanner := bufio.NewScanner(strings.NewReader(rx))
// defer func() {
// if err := expectedScanner.Err(); err != nil {
// t.Fatal(err)
// }
// }()
//
// actualScanner := bufio.NewScanner(strings.NewReader(str))
// defer func() {
// if err := actualScanner.Err(); err != nil {
// t.Fatal(err)
// }
// }()
//
// ok := true
// for {
// asOk := actualScanner.Scan()
// esOk := expectedScanner.Scan()
//
// switch {
// case asOk && esOk:
// ok, err := regexp.MatchString("^"+expectedScanner.Text()+"$", actualScanner.Text())
// if err != nil {
// t.Error(err)
// }
// if !ok {
// t.Errorf("regexp '%s' doesn't match '%s'", expectedScanner.Text(), actualScanner.Text())
// }
// case asOk:
// t.Errorf("didn't expect more lines but got: %s", actualScanner.Text())
// ok = false
// case esOk:
// t.Errorf("didn't got line but expected it to match against: %s", expectedScanner.Text())
// ok = false
// default:
// return ok
// }
// }
// }
//
// func run(arg ...string) error {
// ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
// defer cancel()
// return exec.CommandContext(ctx, "mongo", arg...).Run()
// }
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"github.com/pborman/getopt"
"github.com/percona/percona-toolkit/src/go/lib/profiling"
"github.com/percona/percona-toolkit/src/go/lib/tutil"
"github.com/percona/percona-toolkit/src/go/mongolib/stats"
)
const (
samples = "/src/go/tests/"
)
type testVars struct {
RootPath string
}
type Data struct {
bin string
url string
db string
}
var vars testVars
var client *mongo.Client
func TestMain(m *testing.M) {
var err error
if vars.RootPath, err = tutil.RootPath(); err != nil {
log.Printf("cannot get root path: %s", err.Error())
os.Exit(1)
}
client, err = mongo.Connect(context.TODO(), options.Client().ApplyURI(os.Getenv("PT_TEST_MONGODB_DSN")))
if err != nil {
log.Printf("Cannot connect: %s", err.Error())
os.Exit(1)
}
err = profiling.Disable(context.TODO(), client, "test")
if err != nil {
log.Printf("Cannot disable profile: %s", err.Error())
os.Exit(1)
}
err = profiling.Drop(context.TODO(), client, "test")
if err != nil {
log.Printf("Cannot drop profile database: %s", err.Error())
os.Exit(1)
}
err = profiling.Enable(context.TODO(), client, "test")
if err != nil {
log.Printf("Cannot enable profile: %s", err.Error())
os.Exit(1)
}
retCode := m.Run()
err = profiling.Disable(context.TODO(), client, "test")
if err != nil {
log.Printf("Cannot disable profile: %s", err.Error())
os.Exit(1)
}
os.Exit(retCode)
}
func TestIsProfilerEnabled(t *testing.T) {
mongoDSN := os.Getenv("PT_TEST_MONGODB_DSN")
if mongoDSN == "" {
t.Skip("Skippping TestIsProfilerEnabled. It runs only in integration tests")
}
enabled, err := isProfilerEnabled(context.TODO(), options.Client().ApplyURI(mongoDSN), "test")
//
if err != nil {
t.Errorf("Cannot check if profiler is enabled: %s", err.Error())
}
if enabled != true {
t.Error("Profiler must be enabled")
}
}
func TestParseArgs(t *testing.T) {
tests := []struct {
args []string
want *cliOptions
}{
{
args: []string{TOOLNAME}, // arg[0] is the command itself
want: &cliOptions{
Host: "mongodb://" + DEFAULT_HOST,
LogLevel: DEFAULT_LOGLEVEL,
OrderBy: strings.Split(DEFAULT_ORDERBY, ","),
SkipCollections: strings.Split(DEFAULT_SKIPCOLLECTIONS, ","),
AuthDB: DEFAULT_AUTHDB,
OutputFormat: "text",
},
},
{
args: []string{TOOLNAME, "zapp.brannigan.net:27018/samples", "--help"},
want: nil,
},
{
args: []string{TOOLNAME, "zapp.brannigan.net:27018/samples"},
want: &cliOptions{
Host: "mongodb://zapp.brannigan.net:27018/samples",
LogLevel: DEFAULT_LOGLEVEL,
OrderBy: strings.Split(DEFAULT_ORDERBY, ","),
SkipCollections: strings.Split(DEFAULT_SKIPCOLLECTIONS, ","),
AuthDB: DEFAULT_AUTHDB,
Help: false,
OutputFormat: "text",
},
},
}
for i, test := range tests {
getopt.Reset()
os.Args = test.args
//disabling Stdout to avoid printing help message to the screen
sout := os.Stdout
os.Stdout = nil
got, err := getOptions()
os.Stdout = sout
if err != nil {
t.Errorf("error parsing command line arguments: %s", err.Error())
}
if !reflect.DeepEqual(got, test.want) {
t.Errorf("invalid command line options test %d\ngot %+v\nwant %+v\n", i, got, test.want)
}
}
}
func TestPTMongoDBQueryDigest(t *testing.T) {
var err error
//
binDir, err := ioutil.TempDir("/tmp", "pt-test-bindir")
if err != nil {
t.Error(err)
}
defer func() {
err := os.RemoveAll(binDir)
if err != nil {
t.Error(err)
}
}()
//
bin := binDir + "/pt-mongodb-query-digest"
xVariables := map[string]string{
"main.Build": "<Build>",
"main.Version": "<Version>",
"main.GoVersion": "<GoVersion>",
"main.Commit": "<Commit>",
}
var ldflags []string
for x, value := range xVariables {
ldflags = append(ldflags, fmt.Sprintf("-X %s=%s", x, value))
}
cmd := exec.Command(
"go",
"build",
"-o",
bin,
"-ldflags",
strings.Join(ldflags, " "),
)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
err = cmd.Run()
if err != nil {
t.Error(err)
}
//
data := Data{
bin: bin,
url: os.Getenv("PT_TEST_MONGODB_DSN"),
db: "test",
}
tests := []func(*testing.T, Data){
testVersion,
testEmptySystemProfile,
testAllOperationsTemplate,
}
t.Run("pt-mongodb-query-digest", func(t *testing.T) {
for _, f := range tests {
f := f // capture range variable
fName := runtime.FuncForPC(reflect.ValueOf(f).Pointer()).Name()
t.Run(fName, func(t *testing.T) {
// Clean up system.profile
var err error
err = profiling.Disable(context.TODO(), client, data.db)
if err != nil {
t.Error(err)
}
profiling.Drop(context.TODO(), client, data.db)
err = profiling.Enable(context.TODO(), client, data.db)
if err != nil {
t.Error(err)
}
defer profiling.Disable(context.TODO(), client, data.db)
//
// t.Parallel()
f(t, data)
})
}
})
}
func testVersion(t *testing.T, data Data) {
cmd := exec.Command(
data.bin,
"--version",
)
output, err := cmd.CombinedOutput()
if err != nil {
t.Error(err)
}
expected := `pt-mongodb-query-digest
Version <Version>
Build: <Build> using <GoVersion>
Commit: <Commit>`
//
assertRegexpLines(t, expected, string(output))
}
func testEmptySystemProfile(t *testing.T, data Data) {
cmd := exec.Command(
data.bin,
data.url,
"--database="+data.db,
)
output, err := cmd.CombinedOutput()
if err != nil {
t.Error(err)
}
//
expected := "No queries found in profiler information for database \\\"" + data.db + "\\\""
if !strings.Contains(string(output), expected) {
t.Errorf("Empty system.profile.\nGot:\n%s\nWant:\n%s\n", string(output), expected)
}
}
func testAllOperationsTemplate(t *testing.T, data Data) {
dir := vars.RootPath + samples + "/doc/script/profile/"
files, err := ioutil.ReadDir(dir)
if err != nil {
t.Fatalf("cannot list samples: %s", err)
}
//
fs := []string{}
for _, file := range files {
fs = append(fs, dir+file.Name())
}
sort.Strings(fs)
fs = append([]string{os.Getenv("PT_TEST_MONGODB_DSN")}, fs...)
err = run(fs...)
if err != nil {
t.Fatalf("cannot execute queries: %s", err)
}
//
// disable profiling so pt-mongodb-query digest reads rows from `system.profile`
profiling.Disable(context.TODO(), client, data.db)
//
// run profiler
cmd := exec.Command(
data.bin,
data.url,
"--database="+data.db,
)
//
output, err := cmd.CombinedOutput()
if err != nil {
t.Error(err)
}
//
queries := []stats.QueryStats{
{
ID: "e357abe482dcc0cd03ab742741bf1c86",
Namespace: "test.coll",
Operation: "INSERT",
Fingerprint: "INSERT coll",
},
{
ID: "22eda5c05290c1af6dbffd8c38aceff6",
Namespace: "test.coll",
Operation: "DROP",
Fingerprint: "DROP coll",
},
{
ID: "ba1d8c1620d1aaf36c1010c809ec462b",
Namespace: "test.coll",
Operation: "CREATEINDEXES",
Fingerprint: "CREATEINDEXES coll",
},
{
ID: "db759bfd83441deecc71382323041ce6",
Namespace: "test.coll",
Operation: "GETMORE",
Fingerprint: "GETMORE coll",
},
{
ID: "e72ad41302045bd6c2bcad76511f915a",
Namespace: "test.coll",
Operation: "REMOVE",
Fingerprint: "REMOVE coll a,b",
},
{
ID: "2a639e77efe3e68399ef9482575b3421",
Namespace: "test.coll",
Operation: "FIND",
Fingerprint: "FIND coll",
},
{
ID: "76d7662df07b44135ac3e07e44a6eb39",
Namespace: "",
Operation: "EXPLAIN",
Fingerprint: "EXPLAIN",
},
{
ID: "e8a3f05a4bd3f0bfa7d38eb2372258b1",
Namespace: "test.coll",
Operation: "FINDANDMODIFY",
Fingerprint: "FINDANDMODIFY coll a",
},
{
ID: "30dbfbc89efd8cfd40774dff0266a28f",
Namespace: "test.coll",
Operation: "AGGREGATE",
Fingerprint: "AGGREGATE coll a",
},
{
ID: "fe0bf975a044fe47fd32b835ceba612d",
Namespace: "test.coll",
Operation: "FIND",
Fingerprint: "FIND coll a",
},
{
ID: "20fe80188ec82c9d3c3dcf3f4817f8f9",
Namespace: "test.coll",
Operation: "FIND",
Fingerprint: "FIND coll b,c",
},
{
ID: "02104210d67fe680273784d833f86831",
Namespace: "test.coll",
Operation: "FIND",
Fingerprint: "FIND coll c,k,pad",
},
{
ID: "5efe4738d807c74b3980de76c37a0870",
Namespace: "test.coll",
Operation: "FIND",
Fingerprint: "FIND coll k",
},
{
ID: "e4122a58c99ab0a4020ce7d195c5a8cb",
Namespace: "test.coll",
Operation: "DISTINCT",
Fingerprint: "DISTINCT coll a,b",
},
{
ID: "10b8f47b366fbfd1fb01f8d17d75b1a2",
Namespace: "test.coll",
Operation: "COUNT",
Fingerprint: "COUNT coll a",
},
{
ID: "cc3cb3824eea4094eb042f5ca76bd385",
Namespace: "test.coll",
Operation: "MAPREDUCE",
Fingerprint: "MAPREDUCE coll a",
},
{
ID: "cba2dff0740762c6e5769f0e300df676",
Namespace: "test.coll",
Operation: "COUNT",
Fingerprint: "COUNT coll",
},
{
ID: "f74a5120ac22d02120ccbf6d478b0dbc",
Namespace: "test.coll",
Operation: "UPDATE",
Fingerprint: "UPDATE coll a",
},
}
//
expected := `Profiler is disabled for the "test" database but there are \s*[0-9]+ documents in the system.profile collection.
Using those documents for the stats
# Totals
# Ratio [0-9\.]+ \(docs scanned/returned\)
# Attribute pct total min max avg 95% stddev median
# ================== === ======== ======== ======== ======== ======== ======= ========
# Count \(docs\) (\s*[0-9]+)\s
# Exec Time ms (\s*[0-9]+){8}\s
# Docs Scanned (\s*[0-9\.]+){8}\s
# Docs Returned (\s*[0-9\.]+){8}\s
# Bytes sent (\s*[0-9\.K]+){8}(K|\s)
#\s
`
//
queryTpl := `
# Query [0-9]+: [0-9\.]+ QPS, ID {{.ID}}
# Ratio [0-9\.]+ \(docs scanned/returned\)
# Time range: .* to .*
# Attribute pct total min max avg 95% stddev median
# ================== === ======== ======== ======== ======== ======== ======= ========
# Count \(docs\) (\s*[0-9]+)\s
# Exec Time ms (\s*[0-9]+){8}\s
# Docs Scanned (\s*[0-9\.]+){8}\s
# Docs Returned (\s*[0-9\.]+){8}\s
# Bytes sent (\s*[0-9\.K]+){8}(K|\s)
# String:
# Namespace {{.Namespace}}
# Operation {{.Operation}}
# Fingerprint {{.Fingerprint}}
# Query .*
`
//
tpl, _ := template.New("query").Parse(queryTpl)
for _, query := range queries {
buf := bytes.Buffer{}
err := tpl.Execute(&buf, query)
if err != nil {
t.Error(err)
}
//
expected += buf.String()
}
expected += "\n" // Looks like we expect additional line
//
assertRegexpLines(t, expected, string(output))
}
// assertRegexpLines matches regexp line by line to corresponding line of text
func assertRegexpLines(t *testing.T, rx string, str string, msgAndArgs ...interface{}) bool {
expectedScanner := bufio.NewScanner(strings.NewReader(rx))
defer func() {
if err := expectedScanner.Err(); err != nil {
t.Fatal(err)
}
}()
//
actualScanner := bufio.NewScanner(strings.NewReader(str))
defer func() {
if err := actualScanner.Err(); err != nil {
t.Fatal(err)
}
}()
//
ok := true
for {
asOk := actualScanner.Scan()
esOk := expectedScanner.Scan()
//
switch {
case asOk && esOk:
ok, err := regexp.MatchString("^"+expectedScanner.Text()+"$", actualScanner.Text())
if err != nil {
t.Error(err)
}
if !ok {
t.Errorf("regexp '%s' doesn't match '%s'", expectedScanner.Text(), actualScanner.Text())
}
case asOk:
t.Errorf("didn't expect more lines but got: %s", actualScanner.Text())
ok = false
case esOk:
t.Errorf("didn't got line but expected it to match against: %s", expectedScanner.Text())
ok = false
default:
return ok
}
}
}
func run(arg ...string) error {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
return exec.CommandContext(ctx, "mongo", arg...).Run()
}

View File

@@ -1 +0,0 @@
db.eval("1");

View File

@@ -1,14 +0,0 @@
var coll = db.coll;
coll.drop();
for (var i = 0; i < 10; ++i) {
coll.insert({a: i, b: i % 5});
}
coll.createIndex({b: -1});
coll.group({
key: {a: 1, b: 1},
cond: {b: 3},
reduce: function() {},
initial: {}
});

View File

@@ -151,15 +151,15 @@ $rows = $dbh->selectall_arrayref("select * from mk.queries order by query_id");
is_deeply(
$rows,
[
[ "4950186562421969363",
[ "3608BDE3153F5A7544B298738912D1D3",
"select * from sakila.actor where last_name like ?",
"select * from sakila.actor where last_name like 'A%'",
],
[ "10334408417593890092",
[ "6305C691826EDFA28F6B31B3A67D952C",
"select * from sakila.actor where last_name like ? order by actor_id",
"select * from sakila.actor where last_name like 'A%' order by actor_id",
],
[ "10891801448710051322",
[ "CAF7BE5C0CBA7D07972773B5DA7295FA",
"select * from sakila.actor where actor_id>?",
"select * from sakila.actor where actor_id>10",
],
@@ -172,19 +172,19 @@ $res = $exp_plan eq '5.1' ?
# v5.1 and newer
[
[
"4950186562421969363",
"3608BDE3153F5A7544B298738912D1D3",
qw(sakila actor idx_actor_last_name),
"select * from sakila.actor where last_name like 'A%'",
1,
],
[
"10891801448710051322",
"6305C691826EDFA28F6B31B3A67D952C",
qw(sakila actor PRIMARY),
"select * from sakila.actor where actor_id>10",
2,
],
[
"10334408417593890092",
"CAF7BE5C0CBA7D07972773B5DA7295FA",
qw(sakila actor PRIMARY),
"select * from sakila.actor where last_name like 'A%' order by actor_id",
1,
@@ -194,19 +194,19 @@ $res = $exp_plan eq '5.1' ?
# v5.0 and older
[
[
"4950186562421969363",
"3608BDE3153F5A7544B298738912D1D3",
qw(sakila actor idx_actor_last_name),
"select * from sakila.actor where last_name like 'A%'",
1,
],
[
"10334408417593890092",
"6305C691826EDFA28F6B31B3A67D952C",
qw(sakila actor idx_actor_last_name),
"select * from sakila.actor where last_name like 'A%' order by actor_id",
1,
],
[
"10891801448710051322",
"CAF7BE5C0CBA7D07972773B5DA7295FA",
qw(sakila actor PRIMARY),
"select * from sakila.actor where actor_id>10",
2,
@@ -273,15 +273,16 @@ $rows = $dbh->selectall_arrayref("select * from mk.queries order by query_id");
is_deeply(
$rows,
[
[ "4950186562421969363",
[ "3608BDE3153F5A7544B298738912D1D3",
"select * from sakila.actor where last_name like ?",
"select * from sakila.actor where last_name like 'A%'",
],
[ "10334408417593890092",
[ "6305C691826EDFA28F6B31B3A67D952C",
"select * from sakila.actor where last_name like ? order by actor_id",
"select * from sakila.actor where last_name like 'A%' order by actor_id",
],
[ "10891801448710051322",
[
"CAF7BE5C0CBA7D07972773B5DA7295FA",
"select * from sakila.actor where actor_id>?",
"select * from sakila.actor where actor_id>10",
],
@@ -294,19 +295,19 @@ $res = $exp_plan eq '5.1' ?
# v5.1 and newer
[
[
"4950186562421969363",
"3608BDE3153F5A7544B298738912D1D3",
qw(sakila actor idx_actor_last_name),
"select * from sakila.actor where last_name like 'A%'",
2,
],
[
"10891801448710051322",
"6305C691826EDFA28F6B31B3A67D952C",
qw(sakila actor PRIMARY),
"select * from sakila.actor where actor_id>10",
4,
],
[
"10334408417593890092",
"CAF7BE5C0CBA7D07972773B5DA7295FA",
qw(sakila actor PRIMARY),
"select * from sakila.actor where last_name like 'A%' order by actor_id",
2,
@@ -316,19 +317,19 @@ $res = $exp_plan eq '5.1' ?
# v5.0 and older
[
[
"4950186562421969363",
"3608BDE3153F5A7544B298738912D1D3",
qw(sakila actor idx_actor_last_name),
"select * from sakila.actor where last_name like 'A%'",
2,
],
[
"10334408417593890092",
"6305C691826EDFA28F6B31B3A67D952C",
qw(sakila actor idx_actor_last_name),
"select * from sakila.actor where last_name like 'A%' order by actor_id",
2,
],
[
"10891801448710051322",
"CAF7BE5C0CBA7D07972773B5DA7295FA",
qw(sakila actor PRIMARY),
"select * from sakila.actor where actor_id>10",
4,

View File

@@ -143,7 +143,7 @@ $output = output(
);
like(
$output,
qr/0x69962191E64980E6/,
qr/0x877B0CFF7AD32CA969962191E64980E6/,
'--query-id'
);
@@ -153,7 +153,7 @@ $output = output(
);
like(
$output,
qr/\{"Command"\:"Query","Db"\:"db","Digest"\:"69962191E64980E6","Host"\:"127\.0\.0\.1\:3306","Id"\:"4","Info"\:"\\\/\* fruit\=orange \*\\\/ select 1 from fuits;","Kill_Error"\:"","Reason"\:"","State"\:"statistics","Time"\:"6","Timestamp"\:".*","User"\:"foo","key"\:"value"\}/,
qr/\{"Command"\:"Query","Db"\:"db","Digest"\:"877B0CFF7AD32CA969962191E64980E6","Host"\:"127\.0\.0\.1\:3306","Id"\:"4","Info"\:"\\\/\* fruit\=orange \*\\\/ select 1 from fuits;","Kill_Error"\:"","Reason"\:"","State"\:"statistics","Time"\:"6","Timestamp"\:".*","User"\:"foo","key"\:"value"\}/,
'--json'
);

View File

@@ -459,11 +459,16 @@ $sb->do_as_root("master", q/set sql_log_bin=0/);
$sb->do_as_root("master", q/DROP USER 'slave_user'/);
$sb->do_as_root("master", q/set sql_log_bin=1/);
# Need to wait for both slaves here to avoid deadlock
$sb->wait_for_slaves(slave => 'slave1');
$sb->wait_for_slaves(slave => 'slave2');
# #############################################################################
# Done.
# #############################################################################
$sb->wipe_clean($master_dbh);
$sb->wait_for_slaves();
# Need to wait for both slaves here to avoid deadlock
$sb->wait_for_slaves(slave => 'slave1');
$sb->wait_for_slaves(slave => 'slave2');
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
#
done_testing;

View File

@@ -160,7 +160,173 @@ CREATE TABLE `store` (
CONSTRAINT `fk_store_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8\G
# Query 6: 0 QPS, 0x concurrency, ID 0xCBD4B02B76FCD5BCD8657A03D0724524 at byte 880760
# Query 6: 0 QPS, 0x concurrency, ID 0x2191F33283A3743FAE6D99E149CE09C6 at byte 719980
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:58
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 4 155.05k 155.05k 155.05k 155.05k 155.05k 0 155.05k
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'inventory'\G
# SHOW CREATE TABLE `sakila`.`inventory`\G
INSERT INTO `inventory` VALUES (1,1,1,'2006-02-15 12:09:17') /*... omitted ...*/\G
# Query 7: 0 QPS, 0x concurrency, ID 0x28F5E254B8810D1293E5C17055D970BE at byte 393718
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:54
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 5 167.33k 167.33k 167.33k 167.33k 167.33k 0 167.33k
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'film_actor'\G
# SHOW CREATE TABLE `sakila`.`film_actor`\G
INSERT INTO `film_actor` VALUES (1,1,'2006-02-15 12:05:03') /*... omitted ...*/\G
# Query 8: 0 QPS, 0x concurrency, ID 0x4393885182E112A2E5109B9F2BF996BE at byte 111637
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:48
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 1 64.61k 64.61k 64.61k 64.61k 64.61k 0 64.61k
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'customer'\G
# SHOW CREATE TABLE `sakila`.`customer`\G
INSERT INTO `customer` VALUES (1,1,'MARY','SMITH','MARY.SMITH@sakilacustomer.org',5,1,'2006-02-14 22:04:36','2006-02-15 11:57:20') /*... omitted ...*/\G
# Query 9: 0 QPS, 0x concurrency, ID 0x6846663BC60B4FF9D62F1A6D5A67AFA8 at byte 20196
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 1 53.96k 53.96k 53.96k 53.96k 53.96k 0 53.96k
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'address'\G
# SHOW CREATE TABLE `sakila`.`address`\G
INSERT INTO `address` VALUES (1,'47 MySakila Drive',NULL,'Alberta',300,'','','2006-02-15 11:45:30') /*... omitted ...*/\G
# Query 10: 0 QPS, 0x concurrency, ID 0x45781B86D83AE665EE462EEBC76A46F2 at byte 3392804
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:10:19
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 130 130 130 130 130 0 130
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `percona_test` LIKE 'checksums'\G
# SHOW CREATE TABLE `percona_test`.`checksums`\G
CREATE TABLE percona_test.checksums(
db_tbl varchar(128) not null primary key,
checksum int unsigned not null)\G
# Query 11: 0 QPS, 0x concurrency, ID 0x68FBF2932AA49582C57D5EA5160B0E9F at byte 1859
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:28
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 523 523 523 523 523 0 523
# error code 0 0 0 0 0 0 0 0
# String:
# Databases mysql
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `mysql` LIKE 'innodb_table_stats'\G
# SHOW CREATE TABLE `mysql`.`innodb_table_stats`\G
CREATE TABLE IF NOT EXISTS `innodb_table_stats` (
`database_name` varchar(64) COLLATE utf8_bin NOT NULL,
`table_name` varchar(64) COLLATE utf8_bin NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`n_rows` bigint(20) unsigned NOT NULL,
`clustered_index_size` bigint(20) unsigned NOT NULL,
`sum_of_other_index_sizes` bigint(20) unsigned NOT NULL,
PRIMARY KEY (`database_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin STATS_PERSISTENT=0\G
# Query 12: 0 QPS, 0x concurrency, ID 0xCBD4B02B76FCD5BCD8657A03D0724524 at byte 880760
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:10:00
@@ -212,7 +378,7 @@ select NULL ON UPDATE CASCADE,
KEY `fk_payment_rental` (`rental_id`),
CONSTRAINT `fk_payment_rental` FOREIGN KEY (`rental_id`) REFERENCES `rental` (`rental_id`) ON DELETE \G
# Query 7: 0 QPS, 0x concurrency, ID 0x1B49B966156BD5391405E69931A1FC8D at byte 879222
# Query 13: 0 QPS, 0x concurrency, ID 0x1B49B966156BD5391405E69931A1FC8D at byte 879222
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:59
@@ -243,133 +409,7 @@ CREATE TABLE `language` (
PRIMARY KEY (`language_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8\G
# Query 8: 0 QPS, 0x concurrency, ID 0x0DE767BB5A2112B83B0263BE3363F7DF at byte 8543
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:42
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 370 370 370 370 370 0 370
# @@session.fo 0 0 0 0 0 0 0 0
# @@session.un 0 0 0 0 0 0 0 0
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'actor'\G
# SHOW CREATE TABLE `sakila`.`actor`\G
CREATE TABLE `actor` (
`actor_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`first_name` varchar(45) NOT NULL,
`last_name` varchar(45) NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`actor_id`),
KEY `idx_actor_last_name` (`last_name`)
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8\G
# Query 9: 0 QPS, 0x concurrency, ID 0xC7D5A4E49E422A5209482CA2620152A7 at byte 77796
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:45
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 483 483 483 483 483 0 483
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'city'\G
# SHOW CREATE TABLE `sakila`.`city`\G
CREATE TABLE `city` (
`city_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`city` varchar(50) NOT NULL,
`country_id` smallint(5) unsigned NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`city_id`),
KEY `idx_fk_country_id` (`country_id`),
CONSTRAINT `fk_city_country` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=601 DEFAULT CHARSET=utf8\G
# Query 10: 0 QPS, 0x concurrency, ID 0x06B95BC192D493BF80F6ECA81D5F0D25 at byte 75909
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:44
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 292 292 292 292 292 0 292
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'category'\G
# SHOW CREATE TABLE `sakila`.`category`\G
CREATE TABLE `category` (
`category_id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(25) NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8\G
# Query 11: 0 QPS, 0x concurrency, ID 0x2191F33283A3743FAE6D99E149CE09C6 at byte 719980
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:58
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 4 155.05k 155.05k 155.05k 155.05k 155.05k 0 155.05k
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'inventory'\G
# SHOW CREATE TABLE `sakila`.`inventory`\G
INSERT INTO `inventory` VALUES (1,1,1,'2006-02-15 12:09:17') /*... omitted ...*/\G
# Query 12: 0 QPS, 0x concurrency, ID 0xFFDE0605772D1BD0E771A1D1EAD499BA at byte 718785
# Query 14: 0 QPS, 0x concurrency, ID 0xFFDE0605772D1BD0E771A1D1EAD499BA at byte 718785
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:57
@@ -405,7 +445,57 @@ CREATE TABLE `inventory` (
CONSTRAINT `fk_inventory_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4582 DEFAULT CHARSET=utf8\G
# Query 13: 0 QPS, 0x concurrency, ID 0x1161695D97D5E56D8A38006583244505 at byte 597471
# Query 15: 0 QPS, 0x concurrency, ID 0x661E3CA5D82B964A4E763A2FA103490D at byte 178711
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:49
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 1.19k 1.19k 1.19k 1.19k 1.19k 0 1.19k
# @@session.ch 16 33 33 33 33 33 0 33
# @@session.co 16 33 33 33 33 33 0 33
# @@session.co 11 8 8 8 8 8 0 8
# @@session.sq 25 1.00G 1.00G 1.00G 1.00G 1.00G 0 1.00G
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'film'\G
# SHOW CREATE TABLE `sakila`.`film`\G
CREATE TABLE `film` (
`film_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(255) NOT NULL,
`description` text,
`release_year` year(4) DEFAULT NULL,
`language_id` tinyint(3) unsigned NOT NULL,
`original_language_id` tinyint(3) unsigned DEFAULT NULL,
`rental_duration` tinyint(3) unsigned NOT NULL DEFAULT '3',
`rental_rate` decimal(4,2) NOT NULL DEFAULT '4.99',
`length` smallint(5) unsigned DEFAULT NULL,
`replacement_cost` decimal(5,2) NOT NULL DEFAULT '19.99',
`rating` enum('G','PG','PG-13','R','NC-17') DEFAULT 'G',
`special_features` set('Trailers','Commentaries','Deleted Scenes','Behind the Scenes') DEFAULT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`film_id`),
KEY `idx_title` (`title`),
KEY `idx_fk_language_id` (`language_id`),
KEY `idx_fk_original_language_id` (`original_language_id`),
CONSTRAINT `fk_film_language` FOREIGN KEY (`language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE,
CONSTRAINT `fk_film_language_original` FOREIGN KEY (`original_language_id`) REFERENCES `language` (`language_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8\G
# Query 16: 0 QPS, 0x concurrency, ID 0x1161695D97D5E56D8A38006583244505 at byte 597471
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:56
@@ -437,7 +527,7 @@ CREATE TABLE `film_text` (
FULLTEXT KEY `idx_title_description` (`title`,`description`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8\G
# Query 14: 0 QPS, 0x concurrency, ID 0xE9F9A7EE464D666B0FD12A9C9BF3E41F at byte 565533
# Query 17: 0 QPS, 0x concurrency, ID 0xE9F9A7EE464D666B0FD12A9C9BF3E41F at byte 565533
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:55
@@ -471,33 +561,7 @@ CREATE TABLE `film_category` (
CONSTRAINT `fk_film_category_category` FOREIGN KEY (`category_id`) REFERENCES `category` (`category_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8\G
# Query 15: 0 QPS, 0x concurrency, ID 0x28F5E254B8810D1293E5C17055D970BE at byte 393718
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:54
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 5 167.33k 167.33k 167.33k 167.33k 167.33k 0 167.33k
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'film_actor'\G
# SHOW CREATE TABLE `sakila`.`film_actor`\G
INSERT INTO `film_actor` VALUES (1,1,'2006-02-15 12:05:03') /*... omitted ...*/\G
# Query 16: 0 QPS, 0x concurrency, ID 0xB25BC072BED6DE4E7677746C22CD9F16 at byte 392649
# Query 18: 0 QPS, 0x concurrency, ID 0xB25BC072BED6DE4E7677746C22CD9F16 at byte 392649
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:53
@@ -531,15 +595,15 @@ CREATE TABLE `film_actor` (
CONSTRAINT `fk_film_actor_film` FOREIGN KEY (`film_id`) REFERENCES `film` (`film_id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8\G
# Query 17: 0 QPS, 0x concurrency, ID 0x45781B86D83AE665EE462EEBC76A46F2 at byte 3392804
# Query 19: 0 QPS, 0x concurrency, ID 0x98D4A6F51806DA45C1D332032F48BCE1 at byte 110219
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:10:19
# Time range: all events occurred at 2014-07-02 13:09:47
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 130 130 130 130 130 0 130
# Query size 0 883 883 883 883 883 0 883
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
@@ -553,46 +617,35 @@ CREATE TABLE `film_actor` (
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `percona_test` LIKE 'checksums'\G
# SHOW CREATE TABLE `percona_test`.`checksums`\G
CREATE TABLE percona_test.checksums(
db_tbl varchar(128) not null primary key,
checksum int unsigned not null)\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'customer'\G
# SHOW CREATE TABLE `sakila`.`customer`\G
CREATE TABLE `customer` (
`customer_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`store_id` tinyint(3) unsigned NOT NULL,
`first_name` varchar(45) NOT NULL,
`last_name` varchar(45) NOT NULL,
`email` varchar(50) DEFAULT NULL,
`address_id` smallint(5) unsigned NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`create_date` datetime NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`customer_id`),
KEY `idx_fk_store_id` (`store_id`),
KEY `idx_fk_address_id` (`address_id`),
KEY `idx_last_name` (`last_name`),
CONSTRAINT `fk_customer_address` FOREIGN KEY (`address_id`) REFERENCES `address` (`address_id`) ON UPDATE CASCADE,
CONSTRAINT `fk_customer_store` FOREIGN KEY (`store_id`) REFERENCES `store` (`store_id`) ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=600 DEFAULT CHARSET=utf8\G
# Query 18: 0 QPS, 0x concurrency, ID 0x2F981A9FC6992839C5F99E5B57D2D6DB at byte 3391234
# Query 20: 0 QPS, 0x concurrency, ID 0x90C64F5E9B49C9003E8F75B2422F47B7 at byte 104650
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:10:18
# Time range: all events occurred at 2014-07-02 13:09:46
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 159 159 159 159 159 0 159
# @@session.fo 50 1 1 1 1 1 0 1
# @@session.un 50 1 1 1 1 1 0 1
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
ANALYZE TABLE actor, address, category, city, country, customer, film, film_actor, film_category, film_text, inventory, language, payment, rental, staff, store\G
# Query 19: 0 QPS, 0x concurrency, ID 0xC16F5DCD62BA36A15C6D8C73D42AE624 at byte 3388620
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:10:17
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 0 679 679 679 679 679 0 679
# Query size 0 294 294 294 294 294 0 294
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
@@ -606,78 +659,14 @@ ANALYZE TABLE actor, address, category, city, country, customer, film, film_acto
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'payment'\G
# SHOW CREATE TABLE `sakila`.`payment`\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'rental'\G
# SHOW CREATE TABLE `sakila`.`rental`\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'inventory'\G
# SHOW CREATE TABLE `sakila`.`inventory`\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'store'\G
# SHOW CREATE TABLE `sakila`.`store`\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'address'\G
# SHOW CREATE TABLE `sakila`.`address`\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'city'\G
# SHOW CREATE TABLE `sakila`.`city`\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'country'\G
# SHOW CREATE TABLE `sakila`.`country`\G
# SHOW TABLE STATUS FROM `sakila` LIKE 'staff'\G
# SHOW CREATE TABLE `sakila`.`staff`\G
CREATE ALGORITHM=UNDEFINED DEFINER=`msandbox`@`%` SQL SECURITY DEFINER VIEW `sales_by_store` AS SELECT
CONCAT(c.city, _utf8',', cy.country) AS store
, CONCAT(m.first_name, _utf8' ', m.last_name) AS manager
, SUM(p.amount) AS total_sales
FROM payment AS p
INNER JOIN rental AS r ON p.rental_id = r.rental_id
INNER JOIN inventory AS i ON r.inventory_id = i.inventory_id
INNER JOIN store AS s ON i.store_id = s.store_id
INNER JOIN address AS a ON s.address_id = a.address_id
INNER JOIN city AS c ON a.city_id = c.city_id
INNER JOIN country AS cy ON c.country_id = cy.country_id
INNER JOIN staff AS m ON s.manager_staff_id = m.staff_id
GROUP BY s.store_id
ORDER BY cy.country, c.city\G
# Converted for EXPLAIN
# EXPLAIN /*!50100 PARTITIONS*/
SELECT
CONCAT(c.city, _utf8',', cy.country) AS store
, CONCAT(m.first_name, _utf8' ', m.last_name) AS manager
, SUM(p.amount) AS total_sales
FROM payment AS p
INNER JOIN rental AS r ON p.rental_id = r.rental_id
INNER JOIN inventory AS i ON r.inventory_id = i.inventory_id
INNER JOIN store AS s ON i.store_id = s.store_id
INNER JOIN address AS a ON s.address_id = a.address_id
INNER JOIN city AS c ON a.city_id = c.city_id
INNER JOIN country AS cy ON c.country_id = cy.country_id
INNER JOIN staff AS m ON s.manager_staff_id = m.staff_id
GROUP BY s.store_id
ORDER BY cy.country, c.city\G
# Query 20: 0 QPS, 0x concurrency, ID 0x6846663BC60B4FF9D62F1A6D5A67AFA8 at byte 20196
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2014-07-02 13:09:43
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 0 1
# Exec time 1 1s 1s 1s 1s 1s 0 1s
# Query size 1 53.96k 53.96k 53.96k 53.96k 53.96k 0 53.96k
# error code 0 0 0 0 0 0 0 0
# String:
# Databases sakila
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS FROM `sakila` LIKE 'address'\G
# SHOW CREATE TABLE `sakila`.`address`\G
INSERT INTO `address` VALUES (1,'47 MySakila Drive',NULL,'Alberta',300,'','','2006-02-15 11:45:30') /*... omitted ...*/\G
CREATE TABLE `country` (
`country_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`country` varchar(50) NOT NULL,
`last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`country_id`)
) ENGINE=InnoDB AUTO_INCREMENT=110 DEFAULT CHARSET=utf8\G
# Profile
# Rank Query ID Response time Calls R/Call V/M
@@ -687,19 +676,19 @@ INSERT INTO `address` VALUES (1,'47 MySakila Drive',NULL,'Alberta',300,'','','20
# 3 0x6692BFEDE6AB56814677E4CEDF8EA4E2 5.0000 8.8% 2 2.5000 5.00 INSERT payment
# 4 0x266D117CFD8ED7C1AAECC8184D17D799 3.0000 5.3% 1 3.0000 0.00 INSERT film
# 5 0x5D2F650658D1B9C51A3BF395BD4C2AC5 2.0000 3.5% 1 2.0000 0.00 CREATE TABLE store `store`
# 6 0xCBD4B02B76FCD5BCD8657A03D0724524 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE payment `payment`
# 7 0x1B49B966156BD5391405E69931A1FC8D 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE language `language`
# 8 0x0DE767BB5A2112B83B0263BE3363F7DF 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE actor `actor`
# 9 0xC7D5A4E49E422A5209482CA2620152A7 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE city `city`
# 10 0x06B95BC192D493BF80F6ECA81D5F0D25 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE category `category`
# 11 0x2191F33283A3743FAE6D99E149CE09C6 1.0000 1.8% 1 1.0000 0.00 INSERT inventory
# 12 0xFFDE0605772D1BD0E771A1D1EAD499BA 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE inventory `inventory`
# 13 0x1161695D97D5E56D8A38006583244505 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE film_text `film_text`
# 14 0xE9F9A7EE464D666B0FD12A9C9BF3E41F 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE film_category `film_category`
# 15 0x28F5E254B8810D1293E5C17055D970BE 1.0000 1.8% 1 1.0000 0.00 INSERT film_actor
# 16 0xB25BC072BED6DE4E7677746C22CD9F16 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE film_actor `film_actor`
# 17 0x45781B86D83AE665EE462EEBC76A46F2 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE percona_test.checksums
# 18 0x2F981A9FC6992839C5F99E5B57D2D6DB 1.0000 1.8% 1 1.0000 0.00
# 19 0xC16F5DCD62BA36A15C6D8C73D42AE624 1.0000 1.8% 1 1.0000 0.00 CREATE payment rental inventory store address city country staff
# 20 0x6846663BC60B4FF9D62F1A6D5A67AFA8 1.0000 1.8% 1 1.0000 0.00 INSERT address
# 6 0x2191F33283A3743FAE6D99E149CE09C6 1.0000 1.8% 1 1.0000 0.00 INSERT inventory
# 7 0x28F5E254B8810D1293E5C17055D970BE 1.0000 1.8% 1 1.0000 0.00 INSERT film_actor
# 8 0x4393885182E112A2E5109B9F2BF996BE 1.0000 1.8% 1 1.0000 0.00 INSERT customer
# 9 0x6846663BC60B4FF9D62F1A6D5A67AFA8 1.0000 1.8% 1 1.0000 0.00 INSERT address
# 10 0x45781B86D83AE665EE462EEBC76A46F2 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE percona_test.checksums
# 11 0x68FBF2932AA49582C57D5EA5160B0E9F 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE innodb_table_stats `innodb_table_stats`
# 12 0xCBD4B02B76FCD5BCD8657A03D0724524 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE payment `payment`
# 13 0x1B49B966156BD5391405E69931A1FC8D 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE language `language`
# 14 0xFFDE0605772D1BD0E771A1D1EAD499BA 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE inventory `inventory`
# 15 0x661E3CA5D82B964A4E763A2FA103490D 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE film `film`
# 16 0x1161695D97D5E56D8A38006583244505 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE film_text `film_text`
# 17 0xE9F9A7EE464D666B0FD12A9C9BF3E41F 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE film_category `film_category`
# 18 0xB25BC072BED6DE4E7677746C22CD9F16 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE film_actor `film_actor`
# 19 0x98D4A6F51806DA45C1D332032F48BCE1 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE customer `customer`
# 20 0x90C64F5E9B49C9003E8F75B2422F47B7 1.0000 1.8% 1 1.0000 0.00 CREATE TABLE country `country`
# MISC 0xMISC 6.0000 10.5% 95 0.0632 0.0 <72 ITEMS>

View File

@@ -6,7 +6,33 @@
# Exec time 0 0 0 0 0 0 0
# Query size 964 106 858 482 858 531.74 482
# Query 1: 0 QPS, 0x concurrency, ID 0xC6637FEB865265BA0A3E6DCD23F3445A at byte 237
# Query 1: 0 QPS, 0x concurrency, ID 0xB42FB5382732CE142361B36A4AEB397B at byte 0
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2010-02-11 00:55:24
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 50 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 10 106 106 106 106 106 0 106
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'auction_category_map'\G
# SHOW CREATE TABLE `auction_category_map`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT category_id
FROM auction_category_map
WHERE auction_id = '3015563'\G
# Query 2: 0 QPS, 0x concurrency, ID 0xC6637FEB865265BA0A3E6DCD23F3445A at byte 237
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2010-02-11 00:55:24
@@ -42,34 +68,8 @@ SELECT auction_id, auction_title_en AS title, close_time,
ORDER BY close_time ASC
LIMIT 500\G
# Query 2: 0 QPS, 0x concurrency, ID 0xB42FB5382732CE142361B36A4AEB397B at byte 0
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2010-02-11 00:55:24
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 50 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 10 106 106 106 106 106 0 106
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'auction_category_map'\G
# SHOW CREATE TABLE `auction_category_map`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT category_id
FROM auction_category_map
WHERE auction_id = '3015563'\G
# Profile
# Rank Query ID Response time Calls R/Call V/M
# ==== =================================== ============= ===== ====== ====
# 1 0xC6637FEB865265BA0A3E6DCD23F3445A 0.0000 0.0% 1 0.0000 0.00 SELECT auction_search
# 2 0xB42FB5382732CE142361B36A4AEB397B 0.0000 0.0% 1 0.0000 0.00 SELECT auction_category_map
# 1 0xB42FB5382732CE142361B36A4AEB397B 0.0000 0.0% 1 0.0000 0.00 SELECT auction_category_map
# 2 0xC6637FEB865265BA0A3E6DCD23F3445A 0.0000 0.0% 1 0.0000 0.00 SELECT auction_search

View File

@@ -29,7 +29,68 @@
# 10s+
administrator command: Connect\G
# Query 2: 0 QPS, 0x concurrency, ID 0x68C6B480CBDB8159E2F7D83651089289 at byte 613
# Query 2: 0 QPS, 0x concurrency, ID 0xAB58F0EB775FA5FBF2E9C9BDE150321B at byte 480
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.558791Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 2 47 47 47 47 47 0 47
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
SET collation_connection = 'utf8mb4_unicode_ci'\G
# Query 3: 0 QPS, 0x concurrency, ID 0x1E5B97E780818DDB3B9AD583C3AFC61D at byte 326
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.558713Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 1 27 27 27 27 27 0 27
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
SET CHARACTER SET 'utf8mb4'\G
# Query 4: 0 QPS, 0x concurrency, ID 0x7B48FAA9C951DD8A389FF9DA2DF3DF62 at byte 1135
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.567097Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 0 13 13 13 13 13 0 13
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# EXPLAIN /*!50100 PARTITIONS*/
SELECT USER()\G
# Query 5: 0 QPS, 0x concurrency, ID 0x68C6B480CBDB8159E2F7D83651089289 at byte 613
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.565845Z
@@ -50,15 +111,15 @@ administrator command: Connect\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT CURRENT_USER()\G
# Query 3: 0 QPS, 0x concurrency, ID 0xC4AB84B66A4FBA135A2F00AA08F7A560 at byte 552
# Query 6: 0 QPS, 0x concurrency, ID 0x4C1AABB35EA40368289CE0B9F6EA151D at byte 1870
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.563721Z
# Time range: all events occurred at 2016-06-07T19:07:02.572396Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 2 32 32 32 32 32 0 32
# Query size 8 138 138 138 138 138 0 138
# Query_time distribution
# 1us
# 10us
@@ -69,52 +130,12 @@ SELECT CURRENT_USER()\G
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `mysql` LIKE 'user'\G
# SHOW CREATE TABLE `mysql`.`user`\G
# SHOW TABLE STATUS FROM `INFORMATION_SCHEMA` LIKE 'SCHEMATA'\G
# SHOW CREATE TABLE `INFORMATION_SCHEMA`.`SCHEMATA`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT 1 FROM mysql.user LIMIT 1\G
SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t\G
# Query 4: 0 QPS, 0x concurrency, ID 0xAB58F0EB775FA5FBF2E9C9BDE150321B at byte 480
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.558791Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 2 47 47 47 47 47 0 47
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
SET collation_connection = 'utf8mb4_unicode_ci'\G
# Query 5: 0 QPS, 0x concurrency, ID 0x1E5B97E780818DDB3B9AD583C3AFC61D at byte 326
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.558713Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 1 27 27 27 27 27 0 27
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
SET CHARACTER SET 'utf8mb4'\G
# Query 6: 0 QPS, 0x concurrency, ID 0xF0A406222CD7B02708E4BF21400A779E at byte 2299
# Query 7: 0 QPS, 0x concurrency, ID 0xF0A406222CD7B02708E4BF21400A779E at byte 2299
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.576333Z
@@ -140,79 +161,7 @@ SET CHARACTER SET 'utf8mb4'\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT `tab` FROM `phpmyadmin`.`pma__usergroups` WHERE `allowed` = 'N' AND `tab` LIKE 'server%' AND `usergroup` = (SELECT usergroup FROM `phpmyadmin`.`pma__users` WHERE `username` = 'root')\G
# Query 7: 0 QPS, 0x concurrency, ID 0x1A47B347E419B05A62642FD655801FC1 at byte 2070
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.575723Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 10 160 160 160 160 160 0 160
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `phpmyadmin` LIKE 'pma__bookmark'\G
# SHOW CREATE TABLE `phpmyadmin`.`pma__bookmark`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT `label`, `id`, `query`, `dbase` AS `db`, IF (`user` = '', true, false) AS `shared` FROM `phpmyadmin`.`pma__bookmark` WHERE `user` = '' OR `user` = 'root'\G
# Query 8: 0 QPS, 0x concurrency, ID 0x4C1AABB35EA40368289CE0B9F6EA151D at byte 1870
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.572396Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 8 138 138 138 138 138 0 138
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `INFORMATION_SCHEMA` LIKE 'SCHEMATA'\G
# SHOW CREATE TABLE `INFORMATION_SCHEMA`.`SCHEMATA`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT COUNT(*) FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t\G
# Query 9: 0 QPS, 0x concurrency, ID 0xDDABDE67AC3044CAED549F59FFFA541B at byte 1692
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.569779Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 7 122 122 122 122 122 0 122
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `phpmyadmin` LIKE 'pma__navigationhiding'\G
# SHOW CREATE TABLE `phpmyadmin`.`pma__navigationhiding`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT `db_name`, COUNT(*) AS `count` FROM `phpmyadmin`.`pma__navigationhiding` WHERE `username`='root' GROUP BY `db_name`\G
# Query 10: 0 QPS, 0x concurrency, ID 0x35CCC630581DCD5AA46100310F18DEB9 at byte 1530
# Query 8: 0 QPS, 0x concurrency, ID 0x35CCC630581DCD5AA46100310F18DEB9 at byte 1530
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.569194Z
@@ -238,15 +187,15 @@ SELECT `db_name`, COUNT(*) AS `count` FROM `phpmyadmin`.`pma__navigationhiding`
# EXPLAIN /*!50100 PARTITIONS*/
SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`, (SELECT DB_first_level FROM ( SELECT DISTINCT SUBSTRING_INDEX(SCHEMA_NAME, '_', 1) DB_first_level FROM INFORMATION_SCHEMA.SCHEMATA WHERE TRUE ) t ORDER BY DB_first_level ASC LIMIT 0, 100) t2 WHERE TRUE AND 1 = LOCATE(CONCAT(DB_first_level, '_'), CONCAT(SCHEMA_NAME, '_')) ORDER BY SCHEMA_NAME ASC\G
# Query 11: 0 QPS, 0x concurrency, ID 0x7B48FAA9C951DD8A389FF9DA2DF3DF62 at byte 1135
# Query 9: 0 QPS, 0x concurrency, ID 0x1A47B347E419B05A62642FD655801FC1 at byte 2070
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.567097Z
# Time range: all events occurred at 2016-06-07T19:07:02.575723Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 0 13 13 13 13 13 0 13
# Query size 10 160 160 160 160 160 0 160
# Query_time distribution
# 1us
# 10us
@@ -256,8 +205,59 @@ SELECT `SCHEMA_NAME` FROM `INFORMATION_SCHEMA`.`SCHEMATA`, (SELECT DB_first_leve
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `phpmyadmin` LIKE 'pma__bookmark'\G
# SHOW CREATE TABLE `phpmyadmin`.`pma__bookmark`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT USER()\G
SELECT `label`, `id`, `query`, `dbase` AS `db`, IF (`user` = '', true, false) AS `shared` FROM `phpmyadmin`.`pma__bookmark` WHERE `user` = '' OR `user` = 'root'\G
# Query 10: 0 QPS, 0x concurrency, ID 0xDDABDE67AC3044CAED549F59FFFA541B at byte 1692
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.569779Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 7 122 122 122 122 122 0 122
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `phpmyadmin` LIKE 'pma__navigationhiding'\G
# SHOW CREATE TABLE `phpmyadmin`.`pma__navigationhiding`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT `db_name`, COUNT(*) AS `count` FROM `phpmyadmin`.`pma__navigationhiding` WHERE `username`='root' GROUP BY `db_name`\G
# Query 11: 0 QPS, 0x concurrency, ID 0xC4AB84B66A4FBA135A2F00AA08F7A560 at byte 552
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2016-06-07T19:07:02.563721Z
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 7 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 2 32 32 32 32 32 0 32
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `mysql` LIKE 'user'\G
# SHOW CREATE TABLE `mysql`.`user`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT 1 FROM mysql.user LIMIT 1\G
# Query 12: 0 QPS, 0x concurrency, ID 0x15BF4DCE0B364CE831C14D6853A472B7 at byte 1082
# This item is included in the report because it matches --limit.
@@ -293,14 +293,14 @@ SELECT 1 FROM (SELECT `GRANTEE`, `IS_GRANTABLE` FROM `INFORMATION_SCHEMA`.`COLUM
# Rank Query ID Response time Calls R/Call V/M
# ==== =================================== ============= ===== ====== ====
# 1 0x7417646A9FE969365D51E5F01B88B79E 0.0000 0.0% 2 0.0000 0.00 ADMIN CONNECT
# 2 0x68C6B480CBDB8159E2F7D83651089289 0.0000 0.0% 1 0.0000 0.00 SELECT
# 3 0xC4AB84B66A4FBA135A2F00AA08F7A560 0.0000 0.0% 1 0.0000 0.00 SELECT mysql.user
# 4 0xAB58F0EB775FA5FBF2E9C9BDE150321B 0.0000 0.0% 1 0.0000 0.00 SET
# 5 0x1E5B97E780818DDB3B9AD583C3AFC61D 0.0000 0.0% 1 0.0000 0.00 SET
# 6 0xF0A406222CD7B02708E4BF21400A779E 0.0000 0.0% 1 0.0000 0.00 SELECT phpmyadmin.pma__usergroups phpmyadmin.pma__users
# 7 0x1A47B347E419B05A62642FD655801FC1 0.0000 0.0% 1 0.0000 0.00 SELECT phpmyadmin.pma__bookmark
# 8 0x4C1AABB35EA40368289CE0B9F6EA151D 0.0000 0.0% 1 0.0000 0.00 SELECT INFORMATION_SCHEMA.SCHEMATA
# 9 0xDDABDE67AC3044CAED549F59FFFA541B 0.0000 0.0% 1 0.0000 0.00 SELECT phpmyadmin.pma__navigationhiding
# 10 0x35CCC630581DCD5AA46100310F18DEB9 0.0000 0.0% 1 0.0000 0.00 SELECT INFORMATION_SCHEMA.SCHEMATA
# 11 0x7B48FAA9C951DD8A389FF9DA2DF3DF62 0.0000 0.0% 1 0.0000 0.00 SELECT
# 2 0xAB58F0EB775FA5FBF2E9C9BDE150321B 0.0000 0.0% 1 0.0000 0.00 SET
# 3 0x1E5B97E780818DDB3B9AD583C3AFC61D 0.0000 0.0% 1 0.0000 0.00 SET
# 4 0x7B48FAA9C951DD8A389FF9DA2DF3DF62 0.0000 0.0% 1 0.0000 0.00 SELECT
# 5 0x68C6B480CBDB8159E2F7D83651089289 0.0000 0.0% 1 0.0000 0.00 SELECT
# 6 0x4C1AABB35EA40368289CE0B9F6EA151D 0.0000 0.0% 1 0.0000 0.00 SELECT INFORMATION_SCHEMA.SCHEMATA
# 7 0xF0A406222CD7B02708E4BF21400A779E 0.0000 0.0% 1 0.0000 0.00 SELECT phpmyadmin.pma__usergroups phpmyadmin.pma__users
# 8 0x35CCC630581DCD5AA46100310F18DEB9 0.0000 0.0% 1 0.0000 0.00 SELECT INFORMATION_SCHEMA.SCHEMATA
# 9 0x1A47B347E419B05A62642FD655801FC1 0.0000 0.0% 1 0.0000 0.00 SELECT phpmyadmin.pma__bookmark
# 10 0xDDABDE67AC3044CAED549F59FFFA541B 0.0000 0.0% 1 0.0000 0.00 SELECT phpmyadmin.pma__navigationhiding
# 11 0xC4AB84B66A4FBA135A2F00AA08F7A560 0.0000 0.0% 1 0.0000 0.00 SELECT mysql.user
# 12 0x15BF4DCE0B364CE831C14D6853A472B7 0.0000 0.0% 1 0.0000 0.00 SELECT UNION INFORMATION_SCHEMA.COLUMN_PRIVILEGES INFORMATION_SCHEMA.TABLE_PRIVILEGES INFORMATION_SCHEMA.SCHEMA_PRIVILEGES INFORMATION_SCHEMA.USER_PRIVILEGES

View File

@@ -1,8 +1,8 @@
# Profile
# Rank Query ID Response time Calls R/Call V/M
# ==== ================================== ============= ===== ====== =====
# 1 0x867E8F0D95B72228D4B6A5CD2F2F485C 0.2148 100.0% 1 0.2148 0.00 SELECT t
# Rank Query ID Response time Calls R/Call V/M
# ==== =================================== ============= ===== ====== ====
# 1 0x867E8F0D95B72228D4B6A5CD2F2F485C 0.2148 100.0% 1 0.2148 0.00 SELECT t
# Query 1: 0 QPS, 0x concurrency, ID 0x867E8F0D95B72228D4B6A5CD2F2F485C at byte 0
# This item is included in the report because it matches --limit.
@@ -59,4 +59,4 @@ select t.a, count(*) from t join t t2 using(a) group by 1 order by 2 desc limit
# ref: NULL
# rows: 14
# filtered: 10.00
# Extra: Using where; Using join buffer (Block Nested Loop)
# Extra: Using where; Using join buffer (hash join)

View File

@@ -5,30 +5,7 @@
# Exec time 0 0 0 0 0 0 0
# Query size 70 26 44 35 44 12.73 35
# Query 1: 0 QPS, 0x concurrency, ID 0x813FE962AFBBC891774B2B0B59EBAC2C at byte 27
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 50 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 62 44 44 44 44 44 0 44
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 't2'\G
# SHOW CREATE TABLE `t2`\G
# EXPLAIN /*!50100 PARTITIONS*/
/* Hello, world! */ SELECT * FROM t2 LIMIT 1\G
# Query 2: 0 QPS, 0x concurrency, ID 0x5F47280C0D7DCF5CCB5621E548E5497F at byte 0
# Query 1: 0 QPS, 0x concurrency, ID 0x5F47280C0D7DCF5CCB5621E548E5497F at byte 0
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
@@ -51,8 +28,31 @@
# EXPLAIN /*!50100 PARTITIONS*/
SELECT c FROM t WHERE id=1\G
# Query 2: 0 QPS, 0x concurrency, ID 0x813FE962AFBBC891774B2B0B59EBAC2C at byte 27
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 50 1
# Exec time 0 0 0 0 0 0 0 0
# Query size 62 44 44 44 44 44 0 44
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 't2'\G
# SHOW CREATE TABLE `t2`\G
# EXPLAIN /*!50100 PARTITIONS*/
/* Hello, world! */ SELECT * FROM t2 LIMIT 1\G
# Profile
# Rank Query ID Response time Calls R/Call V/M
# ==== =================================== ============= ===== ====== ====
# 1 0x813FE962AFBBC891774B2B0B59EBAC2C 0.0000 0.0% 1 0.0000 0.00 SELECT t?
# 2 0x5F47280C0D7DCF5CCB5621E548E5497F 0.0000 0.0% 1 0.0000 0.00 SELECT t
# 1 0x5F47280C0D7DCF5CCB5621E548E5497F 0.0000 0.0% 1 0.0000 0.00 SELECT t
# 2 0x813FE962AFBBC891774B2B0B59EBAC2C 0.0000 0.0% 1 0.0000 0.00 SELECT t?

View File

@@ -41,24 +41,24 @@ SET biz = '91848182522'\G
# EXPLAIN /*!50100 PARTITIONS*/
select biz = '91848182522' from foo.bar \G
# Query 2: 0 QPS, 0x concurrency, ID 0x6BADD6C352C61F817546F89214254F2F at byte 815
# Query 2: 0 QPS, 0x concurrency, ID 0xE51503DB1DA4B1FC0FFE94ABA6A2A9E8 at byte 1334
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-12-18 11:48:27
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 12 1
# Exec time 0 512us 512us 512us 512us 512us 0 512us
# Lock time 25 77us 77us 77us 77us 77us 0 77us
# Exec time 4 33ms 33ms 33ms 33ms 33ms 0 33ms
# Lock time 9 28us 28us 28us 28us 28us 0 28us
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Merge passes 0 0 0 0 0 0 0 0
# Query size 13 66 66 66 66 66 0 66
# Query size 20 103 103 103 103 103 0 103
# InnoDB:
# IO r bytes 0 0 0 0 0 0 0 0
# IO r ops 0 0 0 0 0 0 0 0
# IO r wait 0 0 0 0 0 0 0 0
# pages distin 22 24 24 24 24 24 0 24
# pages distin 10 11 11 11 11 11 0 11
# queue wait 0 0 0 0 0 0 0 0
# rec lock wai 0 0 0 0 0 0 0 0
# String:
@@ -68,14 +68,18 @@ select biz = '91848182522' from foo.bar \G
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 100us
# 1ms
# 10ms
# 10ms ################################################################
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `db3` LIKE 'vendor11gonzo'\G
# SHOW CREATE TABLE `db3`.`vendor11gonzo`\G
INSERT INTO db3.vendor11gonzo (makef, bizzle)
VALUES ('', 'Exact')\G
# SHOW TABLE STATUS FROM `db4` LIKE 'vab3concept1upload'\G
# SHOW CREATE TABLE `db4`.`vab3concept1upload`\G
UPDATE db4.vab3concept1upload
SET vab3concept1id = '91848182522'
WHERE vab3concept1upload='6994465'\G
# Converted for EXPLAIN
# EXPLAIN /*!50100 PARTITIONS*/
select vab3concept1id = '91848182522' from db4.vab3concept1upload where vab3concept1upload='6994465'\G

View File

@@ -28,36 +28,7 @@
# SHOW CREATE TABLE `film_actor`\G
INSERT INTO `film_actor` VALUES (1,1,'2006-02-15 10:05:03') /*... omitted ...*/ON duplicate KEY UPDATE actor_id=actor_id+1\G
# Query 2: 0 QPS, 0x concurrency, ID 0x1B65226A5F15AD8CA1C3EE4F5996E672 at byte 342942
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 25 1
# Exec time 25 2s 2s 2s 2s 2s 0 2s
# Lock time 0 0 0 0 0 0 0 0
# Rows sent 25 1 1 1 1 1 0 1
# Rows examine 0 0 0 0 0 0 0 0
# Query size 24 167.33k 167.33k 167.33k 167.33k 167.33k 0 167.33k
# String:
# Hosts localhost
# Users root
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'film_actor'\G
# SHOW CREATE TABLE `film_actor`\G
INSERT IGNORE INTO `film_actor` VALUES (1,1,'2006-02-15 10:05:03') /*... omitted ...*/\G
# Query 3: 0 QPS, 0x concurrency, ID 0x40B5C2023608F2CFA2C576176F348267 at byte 171471
# Query 2: 0 QPS, 0x concurrency, ID 0x40B5C2023608F2CFA2C576176F348267 at byte 171471
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-10-15 21:43:52
@@ -85,3 +56,32 @@ INSERT IGNORE INTO `film_actor` VALUES (1,1,'2006-02-15 10:05:03') /*... omitted
# SHOW TABLE STATUS LIKE 'film_actor'\G
# SHOW CREATE TABLE `film_actor`\G
REPLACE INTO `film_actor` VALUES (1,1,'2006-02-15 10:05:03') /*... omitted ...*/\G
# Query 3: 0 QPS, 0x concurrency, ID 0x1B65226A5F15AD8CA1C3EE4F5996E672 at byte 342942
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Time range: all events occurred at 2007-10-15 21:43:52
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 25 1
# Exec time 25 2s 2s 2s 2s 2s 0 2s
# Lock time 0 0 0 0 0 0 0 0
# Rows sent 25 1 1 1 1 1 0 1
# Rows examine 0 0 0 0 0 0 0 0
# Query size 24 167.33k 167.33k 167.33k 167.33k 167.33k 0 167.33k
# String:
# Hosts localhost
# Users root
# Query_time distribution
# 1us
# 10us
# 100us
# 1ms
# 10ms
# 100ms
# 1s ################################################################
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'film_actor'\G
# SHOW CREATE TABLE `film_actor`\G
INSERT IGNORE INTO `film_actor` VALUES (1,1,'2006-02-15 10:05:03') /*... omitted ...*/\G

View File

@@ -85,8 +85,8 @@ diag(output($cmd)) if not ok(
no_diff(
$cmd,
"$sample/default-results-$sandbox_version.txt",
sed_out => '\'/mysql.plugin$/d; /percona_test.checksums$/d\'',
post_pipe => 'sed \'/mysql.plugin$/d; /percona_test.checksums$/d; /mysql.global_grants$/d\' | ' .
sed_out => '\'/mysql.plugin$/d; /percona_test.checksums$/d; /mysql.help_category$/d; /mysql.help_keyword$/d; /mysql.help_relation$/d; /mysql.help_topic$/d\'',
post_pipe => 'sed \'/mysql.plugin$/d; /percona_test.checksums$/d; /mysql.help_category$/d; /mysql.help_keyword$/d; /mysql.help_relation$/d; /mysql.help_topic$/d; /mysql.ndb_binlog_index$/d; /mysql.global_grants$/d\' | ' .
'awk \'{print $2 " " $3 " " $4 " " $7 " " $9}\'',
),
"Default checksum"

View File

@@ -60,6 +60,9 @@ if ( !$pid ) {
exit;
}
# We need to sleep here to get child process to start
sleep(2);
# parent
PerconaTest::wait_until(sub {
$slave_dbh->selectrow_hashref("show slave status")->{seconds_behind_master}