mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-17 08:57:24 +00:00
pt-galera-log-explainer: fixed nitpicks from review
This commit is contained in:
@@ -70,7 +70,7 @@ func AddHashToIP(hash, ip string, ts time.Time) {
|
||||
db.rwlock.Lock()
|
||||
defer db.rwlock.Unlock()
|
||||
latestValue, ok := db.HashToIP[hash]
|
||||
if !ok {
|
||||
if !ok || latestValue == nil {
|
||||
db.HashToIP[hash] = &translationUnit{Value: ip, Timestamp: ts}
|
||||
} else {
|
||||
latestValue.UpdateTimestamp(ts)
|
||||
|
@@ -33,14 +33,15 @@ Regarding UUIDs (wsrep_gcomm_uuid), different format can be found in logs depend
|
||||
func (w *whois) Run() error {
|
||||
|
||||
if w.SearchType == "auto" {
|
||||
if regex.IsNodeUUID(w.Search) {
|
||||
switch {
|
||||
case regex.IsNodeUUID(w.Search):
|
||||
w.Search = utils.UUIDToShortUUID(w.Search)
|
||||
w.SearchType = "uuid"
|
||||
} else if regex.IsNodeIP(w.Search) {
|
||||
case regex.IsNodeIP(w.Search):
|
||||
w.SearchType = "ip"
|
||||
} else if len(w.Search) != 8 { // at this point it's only a doubt between names and legacy node uuid, where only the first part of the uuid was shown in log
|
||||
case len(w.Search) != 8:
|
||||
w.SearchType = "nodename"
|
||||
} else {
|
||||
default:
|
||||
log.Info().Msg("input information's type is ambiguous, scanning files to discover the type. You can also provide --type to avoid auto-detection")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user