fix analyze limit not work expected (#7430)

Signed-off-by: joelei <thezero12@hotmail.com>
This commit is contained in:
Joe Lei 2020-06-22 17:38:10 +08:00 committed by GitHub
parent 70b0a34616
commit 74a73ba1cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -493,10 +493,10 @@ func analyzeBlock(b tsdb.BlockReader, limit int) error {
sort.Slice(postingInfos, func(i, j int) bool { return postingInfos[i].metric > postingInfos[j].metric }) sort.Slice(postingInfos, func(i, j int) bool { return postingInfos[i].metric > postingInfos[j].metric })
for i, pc := range postingInfos { for i, pc := range postingInfos {
fmt.Printf("%d %s\n", pc.metric, pc.key)
if i >= limit { if i >= limit {
break break
} }
fmt.Printf("%d %s\n", pc.metric, pc.key)
} }
} }