Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/pt-kill
Original file line number Diff line number Diff line change
Expand Up @@ -8731,7 +8731,7 @@ type: string; default: Query

group: Actions

Comma sepatated list of commands that will be watched/killed if they ran for
Comma separated list of commands that will be watched/killed if they ran for
more than L<"--busy-time"> seconds. Default: C<Query>

By default, L<"--busy-time"> kills only C<Query> commands but in some cases, it
Expand Down
4 changes: 2 additions & 2 deletions bin/pt-online-schema-change
Original file line number Diff line number Diff line change
Expand Up @@ -11668,7 +11668,7 @@ sub check_orig_table {
Cxn => $cxn,
tbl => $orig_tbl,
chunk_size => $o->get('chunk-size'),
chunk_indx => $o->get('chunk-index'),
chunk_index => $o->get('chunk-index'),
OptionParser => $o,
TableParser => $tp,
);
Expand Down Expand Up @@ -13512,7 +13512,7 @@ New rows will use the user defined default value if specified for the column.
=item --only-same-schema-fks

Check foreigns keys only on tables on the same schema than the original table.
This option is dangerous since if you have FKs refenrencing tables in other
This option is dangerous since if you have FKs referencing tables in other
schemas, they won't be detected.


Expand Down
2 changes: 1 addition & 1 deletion bin/pt-query-digest
Original file line number Diff line number Diff line change
Expand Up @@ -6239,7 +6239,7 @@ sub _get_value {
unless $found_value;
}
else {
die "Event does not have attribute $attrib and there are no alterantes";
die "Event does not have attribute $attrib and there are no alternates";
}

return $value;
Expand Down
2 changes: 1 addition & 1 deletion bin/pt-table-checksum
Original file line number Diff line number Diff line change
Expand Up @@ -12591,7 +12591,7 @@ sub create_repl_table {
#
# Required Arguments:
# * tbl - Standard tbl hashref
# * sth - Sth with EXLAIN <statement>
# * sth - Sth with EXPLAIN <statement>
# * vals - Values for sth, if any
#
# Returns:
Expand Down
2 changes: 1 addition & 1 deletion bin/pt-variable-advisor
Original file line number Diff line number Diff line change
Expand Up @@ -6082,7 +6082,7 @@ as tmp_table_size.
severity: warn

These are the recommended minimum version for each major release: 3.23, 4.1.20,
5.0.37, 5.1.30, 5.5.8, 5.6.10, 5.7.9, 8.0.11. This optiion does not complain
5.0.37, 5.1.30, 5.5.8, 5.6.10, 5.7.9, 8.0.11. This option does not complain
about Innovation releases.

=item end-of-life mysql version
Expand Down
2 changes: 1 addition & 1 deletion lib/Diskstats.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{
# Package: Diskstats
# This package implements most of the logic in the old shell pt-diskstats;
# it parses data from /proc/diskstats, calculcates deltas, and prints those.
# it parses data from /proc/diskstats, calculates deltas, and prints those.

package Diskstats;

Expand Down
2 changes: 1 addition & 1 deletion lib/EventAggregator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ sub _get_value {
unless $found_value;
}
else {
die "Event does not have attribute $attrib and there are no alterantes";
die "Event does not have attribute $attrib and there are no alternates";
}

return $value;
Expand Down
2 changes: 1 addition & 1 deletion lib/SQLParser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ sub remove_functions {
# GROUP BY and ORDER BY specify a list of identifiers.
#
# Parameters:
# $idents - Arrayref of indentifiers
# $idents - Arrayref of identifiers
#
# Returns:
# Arrayref of hashes with each identifier's parts, depending on what kind
Expand Down
4 changes: 2 additions & 2 deletions lib/SimpleTCPDumpParser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ sub new {
#
# TCP requests and responses form "sessions", which can be in one of these
# statuses:
# [Q]uerying - The remote host is sending the query to the server.
# [R]esponding - The server is replying back to the remote host.
# Querying - The remote host is sending the query to the server.
# Responding - The server is replying back to the remote host.
sub parse_event {
my ( $self, %args ) = @_;
my @required_args = qw(next_event tell);
Expand Down
2 changes: 1 addition & 1 deletion lib/TCPRequestAggregator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ sub parse_event {
# Otherwise, we need to compute the running sums and keep looping.
else {
if ( $self->{in_prg} ) {
# $self->{current_ts} is intitially 0, which would seem likely to
# $self->{current_ts} is initially 0, which would seem likely to
# skew this computation. But $self->{in_prg} will be 0 also, and
# $self->{current_ts} will get set immediately after this, so
# anytime this if() block runs, it'll be OK.
Expand Down
2 changes: 1 addition & 1 deletion lib/VersionCheck.pm
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ sub pingback {

# If the server has suggestions for items, it sends them back in
# the same format: ITEM:TYPE:SUGGESTION\n. ITEM:TYPE is mostly for
# debugging; the tool just repports the suggestions.
# debugging; the tool just reports the suggestions.
$items = parse_server_response(
response => $response->{content},
split_vars => 0,
Expand Down
67 changes: 33 additions & 34 deletions src/go/pt-mongodb-summary/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func main() {
if err != nil {
log.Infof("cannot check version updates: %s", err.Error())
} else if advice != "" {
log.Infof(advice)
log.Infof("%s", advice)
}
}

Expand Down Expand Up @@ -373,49 +373,48 @@ func getHostInfo(ctx context.Context, client *mongo.Client) (*hostInfo, error) {
return nil, errors.Wrap(err, "GetHostInfo.hostInfo")
}

cmdOpts := proto.CommandLineOptions{}
query := primitive.D{{Key: "getCmdLineOpts", Value: 1}}
err := client.Database("admin").RunCommand(ctx, query).Decode(&cmdOpts)
if err != nil {
return nil, errors.Wrap(err, "cannot get command line options")
}

ss := proto.ServerStatus{}
query = primitive.D{{Key: "serverStatus", Value: 1}}
if err := client.Database("admin").RunCommand(ctx, query).Decode(&ss); err != nil {
return nil, errors.Wrap(err, "GetHostInfo.serverStatus")
}

pi := procInfo{}
if err := getProcInfo(int32(ss.Pid), &pi); err != nil {
pi.Error = err
}

nodeType, _ := getNodeType(ctx, client)
procCount, _ := countMongodProcesses()

i := &hostInfo{
Hostname: hi.System.Hostname,
HostOsType: hi.Os.Type,
HostSystemCPUArch: hi.System.CpuArch,
DBPath: "", // Sets default. It will be overridden later if necessary

ProcessName: ss.Process,
ProcProcessCount: procCount,
Version: ss.Version,
NodeType: nodeType,

ProcPath: pi.Path,
ProcUserName: pi.UserName,
ProcCreateTime: pi.CreateTime,
CmdlineArgs: cmdOpts.Argv,
ProcProcessCount: procCount,
NodeType: nodeType,
CmdlineArgs: nil,
}
if ss.Repl != nil {
i.ReplicasetName = ss.Repl.SetName

var cmdOpts proto.CommandLineOptions
query := primitive.D{{Key: "getCmdLineOpts", Value: 1}}
err := client.Database("admin").RunCommand(ctx, query).Decode(&cmdOpts)
if err == nil {
if len(cmdOpts.Argv) > 0 {
i.CmdlineArgs = cmdOpts.Argv
}
if cmdOpts.Parsed.Storage.DbPath != "" {
i.DBPath = cmdOpts.Parsed.Storage.DbPath
}
}

if cmdOpts.Parsed.Storage.DbPath != "" {
i.DBPath = cmdOpts.Parsed.Storage.DbPath
var ss proto.ServerStatus
query = primitive.D{{Key: "serverStatus", Value: 1}}
err = client.Database("admin").RunCommand(ctx, query).Decode(&ss)
if err == nil {
i.ProcessName = ss.Process
i.Version = ss.Version
if ss.Repl != nil {
i.ReplicasetName = ss.Repl.SetName
}

pi := procInfo{}
if err := getProcInfo(int32(ss.Pid), &pi); err != nil {
pi.Error = err
} else {
i.ProcPath = pi.Path
i.ProcUserName = pi.UserName
i.ProcCreateTime = pi.CreateTime
}
}

return i, nil
Expand Down
24 changes: 13 additions & 11 deletions src/go/pt-mongodb-summary/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"time"

"github.com/pborman/getopt"
"github.com/stretchr/testify/require"

tu "github.com/percona/percona-toolkit/src/go/internal/testutils"
"github.com/percona/percona-toolkit/src/go/mongolib/proto"
)

func TestGetHostInfo(t *testing.T) {
Expand Down Expand Up @@ -49,6 +49,18 @@ func TestGetHostInfo(t *testing.T) {
}
}

func TestGetHostInfoResult(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

client, err := tu.TestClient(ctx, tu.MongoDBShard1PrimaryPort)
require.NoError(t, err, "cannot get a new MongoDB client")

host, err := getHostInfo(ctx, client)
require.NoError(t, err, "getHostInfo error")
require.NotEmpty(t, host)
}

func TestClusterWideInfo(t *testing.T) {
testCases := []struct {
name string
Expand Down Expand Up @@ -85,16 +97,6 @@ func TestClusterWideInfo(t *testing.T) {
}
}

func addToCounters(ss proto.ServerStatus, increment int64) proto.ServerStatus {
ss.Opcounters.Command += increment
ss.Opcounters.Delete += increment
ss.Opcounters.GetMore += increment
ss.Opcounters.Insert += increment
ss.Opcounters.Query += increment
ss.Opcounters.Update += increment
return ss
}

func TestParseArgs(t *testing.T) {
tests := []struct {
args []string
Expand Down