pt-galera-log-explainer: fixed nitpicks from review

This commit is contained in:
Yoann La Cancellera
2024-03-22 15:24:03 +01:00
parent 9dbed00bee
commit 8acb578e80
2 changed files with 5 additions and 3 deletions

View File

@@ -70,10 +70,10 @@ func AddHashToIP(hash, ip string, ts time.Time) {
db.rwlock.Lock()
defer db.rwlock.Unlock()
latestValue, ok := db.HashToIP[hash]
if !ok || latestValue == nil {
db.HashToIP[hash] = &translationUnit{Value: ip, Timestamp: ts}
} else {
if ok && latestValue != nil {
latestValue.UpdateTimestamp(ts)
} else {
db.HashToIP[hash] = &translationUnit{Value: ip, Timestamp: ts}
}
}

View File

@@ -40,6 +40,8 @@ func (w *whois) Run() error {
case regex.IsNodeIP(w.Search):
w.SearchType = "ip"
case 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
// legacy UUIDs were 8 characters long, so anything else has to be nodename
w.SearchType = "nodename"
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")