Fix: typos

This commit is contained in:
Yoann La Cancellera
2023-11-21 15:57:15 +01:00
committed by Sveta Smirnova
parent 7876a0511c
commit 3fae43123e
10 changed files with 24 additions and 24 deletions

View File

@@ -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)

View File

@@ -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<memberlog>" + IdentsMap["RegexMemberCount"].Regex.String() + ")(?P<compiledAssocations>(....-?[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<memberlog>" + IdentsMap["RegexMemberCount"].Regex.String() + ")(?P<compiledAssociations>(....-?[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)

View File

@@ -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"))
},

View File

@@ -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)"))
},

View File

@@ -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",
},
}

View File

@@ -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()

View File

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

View File

@@ -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 &&

View File

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

View File

@@ -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)