mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-11 21:51:21 +00:00
Fix: missed errors, minor formatting issues
This commit is contained in:

committed by
Sveta Smirnova

parent
2a97f061db
commit
bb6c5e1abd
@@ -132,10 +132,13 @@ func execGrepAndIterate(path, compiledRegex string, stdout chan<- string) error
|
|||||||
|
|
||||||
cmd := exec.Command(CLI.GrepCmd, "-P", compiledRegex, path)
|
cmd := exec.Command(CLI.GrepCmd, "-P", compiledRegex, path)
|
||||||
|
|
||||||
out, _ := cmd.StdoutPipe()
|
out, err := cmd.StdoutPipe()
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "could not open stdout pipe")
|
||||||
|
}
|
||||||
defer out.Close()
|
defer out.Close()
|
||||||
|
|
||||||
err := cmd.Start()
|
err = cmd.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "failed to search in %s", path)
|
return errors.Wrapf(err, "failed to search in %s", path)
|
||||||
}
|
}
|
||||||
|
@@ -50,7 +50,11 @@ func (l *list) Run() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if CLI.Verbosity == types.Debug {
|
if CLI.Verbosity == types.Debug {
|
||||||
fmt.Println(translate.DBToJson())
|
out, err := translate.DBToJson()
|
||||||
|
if err != nil {
|
||||||
|
return errors.Wrap(err, "could not dump translation structs to json")
|
||||||
|
}
|
||||||
|
fmt.Println(out)
|
||||||
}
|
}
|
||||||
|
|
||||||
display.TimelineCLI(timeline, CLI.Verbosity)
|
display.TimelineCLI(timeline, CLI.Verbosity)
|
||||||
|
@@ -25,7 +25,7 @@ type translationsDB struct {
|
|||||||
|
|
||||||
// incase methods changed in the middle, tls=>ssl
|
// incase methods changed in the middle, tls=>ssl
|
||||||
IPToMethods map[string][]translationUnit
|
IPToMethods map[string][]translationUnit
|
||||||
rwlock *sync.RWMutex
|
rwlock sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
var AssumeIPStable bool = true
|
var AssumeIPStable bool = true
|
||||||
@@ -42,7 +42,6 @@ func initTranslationsDB() {
|
|||||||
HashToNodeNames: map[string][]translationUnit{},
|
HashToNodeNames: map[string][]translationUnit{},
|
||||||
IPToMethods: map[string][]translationUnit{},
|
IPToMethods: map[string][]translationUnit{},
|
||||||
IPToNodeNames: map[string][]translationUnit{},
|
IPToNodeNames: map[string][]translationUnit{},
|
||||||
rwlock: &sync.RWMutex{},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,9 +50,9 @@ func ResetDB() {
|
|||||||
initTranslationsDB()
|
initTranslationsDB()
|
||||||
}
|
}
|
||||||
|
|
||||||
func DBToJson() string {
|
func DBToJson() (string, error) {
|
||||||
out, _ := json.MarshalIndent(db, "", "\t")
|
out, err := json.MarshalIndent(db, "", "\t")
|
||||||
return string(out)
|
return string(out), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetDB() translationsDB {
|
func GetDB() translationsDB {
|
||||||
|
@@ -45,6 +45,7 @@ func (cs Conflicts) OldestUnresolved() *Conflict {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cs Conflicts) ConflictFromMD5(md5 string) *Conflict {
|
func (cs Conflicts) ConflictFromMD5(md5 string) *Conflict {
|
||||||
for _, c := range cs {
|
for _, c := range cs {
|
||||||
for _, vote := range c.VotePerNode {
|
for _, vote := range c.VotePerNode {
|
||||||
|
@@ -75,7 +75,6 @@ func (ctx *LogCtx) SetState(s string) {
|
|||||||
if !utils.SliceContains([]string{"SYNCED", "JOINED", "DONOR", "DESYNCED", "JOINER", "PRIMARY", "NON-PRIMARY", "OPEN", "CLOSED", "DESTROYED", "ERROR", "RECOVERY"}, s) {
|
if !utils.SliceContains([]string{"SYNCED", "JOINED", "DONOR", "DESYNCED", "JOINER", "PRIMARY", "NON-PRIMARY", "OPEN", "CLOSED", "DESTROYED", "ERROR", "RECOVERY"}, s) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//ctx.state[ctx.FileType] = append(ctx.state[ctx.FileType], s)
|
|
||||||
switch ctx.FileType {
|
switch ctx.FileType {
|
||||||
case "post.processing.log":
|
case "post.processing.log":
|
||||||
ctx.statePostProcessingLog = s
|
ctx.statePostProcessingLog = s
|
||||||
|
Reference in New Issue
Block a user