diff --git a/src/go/pt-galera-log-explainer/display/timelinecli.go b/src/go/pt-galera-log-explainer/display/timelinecli.go index 86fd1f1f..24243dd7 100644 --- a/src/go/pt-galera-log-explainer/display/timelinecli.go +++ b/src/go/pt-galera-log-explainer/display/timelinecli.go @@ -233,7 +233,7 @@ type transitionSummary [RowPerTransitions]string // because only those transitions are implemented: file path, ip, node name, version const NumberOfPossibleTransition = 4 -// transactionSeparator is useful to highligh a change of context +// transactionSeparator is useful to highlight a change of context // example, changing file // mysqld.log.2 // (file path) diff --git a/src/go/pt-galera-log-explainer/regex/operator.go b/src/go/pt-galera-log-explainer/regex/operator.go index 3612bf5f..fc815005 100644 --- a/src/go/pt-galera-log-explainer/regex/operator.go +++ b/src/go/pt-galera-log-explainer/regex/operator.go @@ -46,7 +46,7 @@ var PXCOperatorMap = types.RegexMap{ // it could have been useful as an "verbosity=types.Detailed" regexes, very rarely // but in context of operators, it is actually a very important information "RegexGcacheScan": &types.LogRegex{ - // those "operators" regexes do not have the log prefix added implicitely. It's not strictly needed, but + // those "operators" regexes do not have the log prefix added implicitly. It's not strictly needed, but // it will help to avoid catching random piece of log out of order Regex: regexp.MustCompile(k8sprefix + ".*GCache::RingBuffer initial scan"), Handler: func(submatches map[string]string, ctx types.LogCtx, log string, date time.Time) (types.LogCtx, types.LogDisplayer) { @@ -59,7 +59,7 @@ var PXCOperatorMap = types.RegexMap{ // so this regex is about capturing subgroups to re-handle each them to the appropriate existing IdentsMap regex "RegexOperatorMemberAssociations": &types.LogRegex{ Regex: regexp.MustCompile("================================================.*View:"), - InternalRegex: regexp.MustCompile("own_index: " + regexIdx + ".*(?P" + IdentsMap["RegexMemberCount"].Regex.String() + ")(?P(....-?[0-9]{1,2}(\\.-?[0-9])?: [a-z0-9]+-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]+, [a-zA-Z0-9-_\\.]+)+)"), + InternalRegex: regexp.MustCompile("own_index: " + regexIdx + ".*(?P" + IdentsMap["RegexMemberCount"].Regex.String() + ")(?P(....-?[0-9]{1,2}(\\.-?[0-9])?: [a-z0-9]+-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]+, [a-zA-Z0-9-_\\.]+)+)"), Handler: func(submatches map[string]string, ctx types.LogCtx, log string, date time.Time) (types.LogCtx, types.LogDisplayer) { ctx.MyIdx = submatches[groupIdx] @@ -72,13 +72,13 @@ var PXCOperatorMap = types.RegexMap{ ctx, displayer = IdentsMap["RegexMemberCount"].Handle(ctx, submatches["memberlog"], date) msg += displayer(ctx) + "; " - subAssociations := strings.Split(submatches["compiledAssocations"], "\\n\\t") + subAssociations := strings.Split(submatches["compiledAssociations"], "\\n\\t") if len(subAssociations) < 2 { return ctx, types.SimpleDisplayer(msg) } - for _, subAssocation := range subAssociations[1:] { + for _, subAssociation := range subAssociations[1:] { // better to reuse the idents regex - ctx, displayer = IdentsMap["RegexMemberAssociations"].Handle(ctx, subAssocation, date) + ctx, displayer = IdentsMap["RegexMemberAssociations"].Handle(ctx, subAssociation, date) msg += displayer(ctx) + "; " } return ctx, types.SimpleDisplayer(msg) diff --git a/src/go/pt-galera-log-explainer/regex/sst.go b/src/go/pt-galera-log-explainer/regex/sst.go index eb546547..b893cdb9 100644 --- a/src/go/pt-galera-log-explainer/regex/sst.go +++ b/src/go/pt-galera-log-explainer/regex/sst.go @@ -273,7 +273,7 @@ var SSTMap = types.RegexMap{ }, "RegexTimeoutReceivingFirstData": &types.LogRegex{ - Regex: regexp.MustCompile("Possible timeout in receving first data from donor in gtid/keyring stage"), + Regex: regexp.MustCompile("Possible timeout in receving first data from donor in gtid/keyring stage"), // typo is in Galera lib Handler: func(submatches map[string]string, ctx types.LogCtx, log string, date time.Time) (types.LogCtx, types.LogDisplayer) { return ctx, types.SimpleDisplayer(utils.Paint(utils.RedText, "timeout from donor in gtid/keyring stage")) }, diff --git a/src/go/pt-galera-log-explainer/regex/views.go b/src/go/pt-galera-log-explainer/regex/views.go index 64ca6469..62866582 100644 --- a/src/go/pt-galera-log-explainer/regex/views.go +++ b/src/go/pt-galera-log-explainer/regex/views.go @@ -147,7 +147,7 @@ var ViewsMap = types.RegexMap{ }, }, - "RegexSafeToBoostrapSet": &types.LogRegex{ + "RegexSafeToBootstrapSet": &types.LogRegex{ Regex: regexp.MustCompile("safe_to_bootstrap: 1"), Handler: func(submatches map[string]string, ctx types.LogCtx, log string, date time.Time) (types.LogCtx, types.LogDisplayer) { return ctx, types.SimpleDisplayer(utils.Paint(utils.YellowText, "safe_to_bootstrap: 1")) @@ -159,8 +159,8 @@ var ViewsMap = types.RegexMap{ return ctx, types.SimpleDisplayer(utils.Paint(utils.YellowText, "no grastate.dat file")) }, }, - "RegexBootstrapingDefaultState": &types.LogRegex{ - Regex: regexp.MustCompile("Bootstraping with default state"), + "RegexBootstrappingDefaultState": &types.LogRegex{ + Regex: regexp.MustCompile("Bootstraping with default state"), // typo is in Galera lib Handler: func(submatches map[string]string, ctx types.LogCtx, log string, date time.Time) (types.LogCtx, types.LogDisplayer) { return ctx, types.SimpleDisplayer(utils.Paint(utils.YellowText, "bootstrapping(empty grastate)")) }, diff --git a/src/go/pt-galera-log-explainer/regex/views_test.go b/src/go/pt-galera-log-explainer/regex/views_test.go index 12642e96..a7c4f6a8 100644 --- a/src/go/pt-galera-log-explainer/regex/views_test.go +++ b/src/go/pt-galera-log-explainer/regex/views_test.go @@ -200,13 +200,13 @@ func TestViewsRegex(t *testing.T) { { log: "2001-01-01T01:01:01.000000Z 0 [Note] WSREP: Found saved state: 8e862473-455e-11e8-a0ca-3fcd8faf3209:-1, safe_to_bootstrap: 1", expectedOut: "safe_to_bootstrap: 1", - key: "RegexSafeToBoostrapSet", + key: "RegexSafeToBootstrapSet", }, { name: "should not match", log: "2001-01-01T01:01:01.000000Z 0 [Note] WSREP: Found saved state: 8e862473-455e-11e8-a0ca-3fcd8faf3209:-1, safe_to_bootstrap: 0", expectedErr: true, - key: "RegexSafeToBoostrapSet", + key: "RegexSafeToBootstrapSet", }, { @@ -218,7 +218,7 @@ func TestViewsRegex(t *testing.T) { { log: "2001-01-01T01:01:01.000000Z 0 [Warning] [MY-000000] [Galera] No persistent state found. Bootstraping with default state", expectedOut: "bootstrapping(empty grastate)", - key: "RegexBootstrapingDefaultState", + key: "RegexBootstrappingDefaultState", }, } diff --git a/src/go/pt-galera-log-explainer/sed.go b/src/go/pt-galera-log-explainer/sed.go index 5de8fb3b..988ce64d 100644 --- a/src/go/pt-galera-log-explainer/sed.go +++ b/src/go/pt-galera-log-explainer/sed.go @@ -47,7 +47,7 @@ func (s *sed) Run() error { } if len(args) == 0 { - return errors.New("could not find informations to replace") + return errors.New("could not find information to replace") } fstat, err := os.Stdin.Stat() diff --git a/src/go/pt-galera-log-explainer/types/ctx.go b/src/go/pt-galera-log-explainer/types/ctx.go index 79789b44..11410952 100644 --- a/src/go/pt-galera-log-explainer/types/ctx.go +++ b/src/go/pt-galera-log-explainer/types/ctx.go @@ -10,9 +10,9 @@ import ( // LogCtx is the main context storage for a node. // It is the principal storage of this tool, this is the source of truth to merge logs and take decisions -// It is stored along wih each single log line we matched, and copied for each new log line. +// It is stored along with each single log line we matched, and copied for each new log line. // It is NOT meant to be used as a singleton by pointer, it must keep its original state for each log lines -// If not, every informaiton would be overwritten (states, sst, version, membercount, ...) and we would not be able to give the history of changes +// If not, every information would be overwritten (states, sst, version, membercount, ...) and we would not be able to give the history of changes type LogCtx struct { FilePath string FileType string @@ -48,7 +48,7 @@ func (ctx *LogCtx) InitMaps() { // State will return the wsrep state of the current file type // That is because for operator related logs, we have every type of files -// Not tracking and differenciating by file types led to confusions in most subcommands +// Not tracking and differentiating by file types led to confusions in most subcommands // as it would seem that sometimes mysql is restarting after a crash, while actually // the operator was simply launching a "wsrep-recover" instance while mysql was still running func (ctx LogCtx) State() string { @@ -101,7 +101,7 @@ func (ctx *LogCtx) IsPrimary() bool { // AddOwnName propagates a name into the translation maps using the trusted node's known own hashes and ips func (ctx *LogCtx) AddOwnName(name string, date time.Time) { // used to be a simple "if utils.SliceContains", changed to "is it the last known name?" - // because somes names/ips come back and forth, we should keep track of that + // because some names/ips come back and forth, we should keep track of that name = utils.ShortNodeName(name) if len(ctx.OwnNames) > 0 && ctx.OwnNames[len(ctx.OwnNames)-1] == name { return diff --git a/src/go/pt-galera-log-explainer/types/loginfo.go b/src/go/pt-galera-log-explainer/types/loginfo.go index 089882f0..0aaf62f7 100644 --- a/src/go/pt-galera-log-explainer/types/loginfo.go +++ b/src/go/pt-galera-log-explainer/types/loginfo.go @@ -62,7 +62,7 @@ func (li *LogInfo) Msg(ctx LogCtx) string { return msg } -// IsDuplicatedEvent will aim to keep 2 occurences of the same event +// IsDuplicatedEvent will aim to keep 2 occurrences of the same event // To be considered duplicated, they must be from the same regexes and have the same message func (current *LogInfo) IsDuplicatedEvent(base, previous LogInfo) bool { return base.RegexUsed == previous.RegexUsed && diff --git a/src/go/pt-galera-log-explainer/types/timeline.go b/src/go/pt-galera-log-explainer/types/timeline.go index ee8463b6..bb5ca65f 100644 --- a/src/go/pt-galera-log-explainer/types/timeline.go +++ b/src/go/pt-galera-log-explainer/types/timeline.go @@ -11,7 +11,7 @@ type LocalTimeline []LogInfo func (lt LocalTimeline) Add(li LogInfo) LocalTimeline { - // to deduplicate, it will keep 2 loginfo occurences + // to deduplicate, it will keep 2 loginfo occurrences // 1st one for the 1st timestamp found, it will also show the number of repetition // 2nd loginfo the keep the last timestamp found, so that we don't loose track // so there will be a corner case if the first ever event is repeated, but that is acceptable diff --git a/src/go/pt-galera-log-explainer/utils/utils.go b/src/go/pt-galera-log-explainer/utils/utils.go index db739184..c27463e0 100644 --- a/src/go/pt-galera-log-explainer/utils/utils.go +++ b/src/go/pt-galera-log-explainer/utils/utils.go @@ -10,7 +10,7 @@ import ( // Color is given its own type for safe function signatures type Color string -// Color codes interpretted by the terminal +// Color codes interpreted by the terminal // NOTE: all codes must be of the same length or they will throw off the field alignment of tabwriter const ( ResetText Color = "\x1b[0000m" @@ -109,11 +109,11 @@ func StringsReplaceReversed(s, old, new string, n int) string { } func UUIDToShortUUID(uuid string) string { - splitted := strings.Split(uuid, "-") - if len(splitted) != 5 { + split := strings.Split(uuid, "-") + if len(split) != 5 { return uuid } - return splitted[0] + "-" + splitted[3] + return split[0] + "-" + split[3] } // ShortNodeName helps reducing the node name when it is the default value (node hostname)