Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1085 from grafana/fix-mt-idx-cat-partition-handling
Browse files Browse the repository at this point in the history
process partitions after flag.Parse
  • Loading branch information
Dieterbe authored Oct 5, 2018
2 parents c003cb7 + 44f3ac6 commit a3c525d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions cmd/mt-index-cat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,6 @@ func main() {
os.Exit(-1)
}

var partitions []int32
if partitionStr != "*" {
for _, p := range strings.Split(partitionStr, ",") {
p = strings.TrimSpace(p)

// handle trailing "," on the list of partitions.
if p == "" {
continue
}

id, err := strconv.ParseInt(p, 10, 32)
if err != nil {
log.Printf("invalid partition id %q. must be a int32", p)
flag.Usage()
os.Exit(-1)
}
partitions = append(partitions, int32(id))
}
}

format := os.Args[len(os.Args)-1]
var found bool
if strings.Contains(format, "{{") {
Expand Down Expand Up @@ -203,6 +183,26 @@ func main() {
cutoffMin = now - int64(minStaleInt)
}

var partitions []int32
if partitionStr != "*" {
for _, p := range strings.Split(partitionStr, ",") {
p = strings.TrimSpace(p)

// handle trailing "," on the list of partitions.
if p == "" {
continue
}

id, err := strconv.ParseInt(p, 10, 32)
if err != nil {
log.Printf("invalid partition id %q. must be a int32", p)
flag.Usage()
os.Exit(-1)
}
partitions = append(partitions, int32(id))
}
}

var defs []schema.MetricDefinition
if len(partitions) == 0 {
defs = idx.Load(nil, uint32(cutoff))
Expand Down

0 comments on commit a3c525d

Please sign in to comment.