Skip to content

Commit

Permalink
Gofmt verify-wal files
Browse files Browse the repository at this point in the history
  • Loading branch information
adamperlin committed Jun 27, 2019
1 parent 107f2c6 commit bbb08ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
4 changes: 0 additions & 4 deletions cmd/influxd/inspect/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,3 @@ func NewCommand() *cobra.Command {

return base
}




8 changes: 4 additions & 4 deletions cmd/influxd/inspect/verify_wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

func NewVerifyWALCommand() *cobra.Command {
verifyWALCommand := &cobra.Command{
Use: `verify-wal`,
Use: `verify-wal`,
Short: "Check for WAL corruption",
Long: `
This command will analyze the WAL (Write-Ahead Log) in a storage directory to
Expand Down Expand Up @@ -47,9 +47,9 @@ var verifyWALFlags = struct {
// inspectReportTSMF runs the report-tsm tool.
func inspectVerifyWAL(cmd *cobra.Command, args []string) error {
report := &wal.Verifier{
Stderr: os.Stderr,
Stdout: os.Stdout,
Dir: verifyWALFlags.dataDir,
Stderr: os.Stderr,
Stdout: os.Stdout,
Dir: verifyWALFlags.dataDir,
}

_, err := report.Run(true)
Expand Down
14 changes: 7 additions & 7 deletions storage/wal/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type Verifier struct {
}

type VerificationSummary struct {
EntryCount int
FileCount int
EntryCount int
FileCount int
CorruptFiles []string
}

Expand Down Expand Up @@ -59,7 +59,7 @@ func (v *Verifier) Run(print bool) (*VerificationSummary, error) {
for _, fpath := range files {
f, err := os.OpenFile(fpath, os.O_RDONLY, 0600)
if err != nil {
fmt.Fprintf(v.Stderr, "error opening file %s: %v. Exiting",fpath, err)
fmt.Fprintf(v.Stderr, "error opening file %s: %v. Exiting", fpath, err)
}

clean := true
Expand All @@ -69,7 +69,7 @@ func (v *Verifier) Run(print bool) (*VerificationSummary, error) {
_, err := reader.Read()
if err != nil {
clean = false
fmt.Fprintf(tw,"%s: corrupt entry found at position %d\n", fpath, reader.Count())
fmt.Fprintf(tw, "%s: corrupt entry found at position %d\n", fpath, reader.Count())
corruptFiles = append(corruptFiles, fpath)
break
}
Expand All @@ -86,7 +86,7 @@ func (v *Verifier) Run(print bool) (*VerificationSummary, error) {
fmt.Fprintf(tw, " Total entries checked: %d\n", entriesScanned)
fmt.Fprintf(tw, " Corrupt files found: ")
if len(corruptFiles) == 0 {
fmt.Fprintf(tw,"None")
fmt.Fprintf(tw, "None")
} else {
for _, name := range corruptFiles {
fmt.Fprintf(tw, "\n %s", name)
Expand All @@ -96,9 +96,9 @@ func (v *Verifier) Run(print bool) (*VerificationSummary, error) {
fmt.Fprintf(tw, "\nCompleted in %v\n", time.Since(start))

summary := &VerificationSummary{
EntryCount: entriesScanned,
EntryCount: entriesScanned,
CorruptFiles: corruptFiles,
FileCount: len(files),
FileCount: len(files),
}

return summary, nil
Expand Down

0 comments on commit bbb08ad

Please sign in to comment.