lib/storage: typo fixes found by golangci-lint; updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/69

This commit is contained in:
Aliaksandr Valialkin 2019-06-20 14:37:46 +03:00
parent 296c14317f
commit 80db24386e
5 changed files with 3 additions and 14 deletions

View file

@ -250,7 +250,7 @@ func (db *indexDB) incRef() {
func (db *indexDB) decRef() { func (db *indexDB) decRef() {
n := atomic.AddUint64(&db.refCount, ^uint64(0)) n := atomic.AddUint64(&db.refCount, ^uint64(0))
if n < 0 { if int64(n) < 0 {
logger.Panicf("BUG: negative refCount: %d", n) logger.Panicf("BUG: negative refCount: %d", n)
} }
if n > 0 { if n > 0 {

View file

@ -88,8 +88,6 @@ func BenchmarkIndexDBSearchTSIDs(b *testing.B) {
} }
}() }()
const accountsCount = 111
const projectsCount = 33333
const recordsCount = 1e5 const recordsCount = 1e5
// Fill the db with recordsCount records. // Fill the db with recordsCount records.
@ -160,8 +158,6 @@ func BenchmarkIndexDBGetTSIDs(b *testing.B) {
}() }()
const recordsPerLoop = 1000 const recordsPerLoop = 1000
const accountsCount = 111
const projectsCount = 33333
const recordsCount = 1e5 const recordsCount = 1e5
// Fill the db with recordsCount records. // Fill the db with recordsCount records.

View file

@ -586,13 +586,6 @@ func copyTags(dst, src []Tag) []Tag {
return dst return dst
} }
func (mn *MetricName) tagsLess(i, j int) bool {
a, b := mn.Tags[i].Key, mn.Tags[j].Key
a = normalizeTagKey(a)
b = normalizeTagKey(b)
return bytes.Compare(a, b) < 0
}
var commonTagKeys = func() map[string][]byte { var commonTagKeys = func() map[string][]byte {
lcm := map[string][]byte{ lcm := map[string][]byte{
// job-like tags must go first in MetricName.Tags. // job-like tags must go first in MetricName.Tags.

View file

@ -44,7 +44,7 @@ func TestSearchQueryMarshalUnmarshal(t *testing.T) {
if sq1.MaxTimestamp != sq2.MaxTimestamp { if sq1.MaxTimestamp != sq2.MaxTimestamp {
t.Fatalf("unexpected MaxTimestamp; got %d; want %d", sq2.MaxTimestamp, sq1.MaxTimestamp) t.Fatalf("unexpected MaxTimestamp; got %d; want %d", sq2.MaxTimestamp, sq1.MaxTimestamp)
} }
if len(sq1.TagFilterss) != len(sq1.TagFilterss) { if len(sq1.TagFilterss) != len(sq2.TagFilterss) {
t.Fatalf("unexpected TagFilterss len; got %d; want %d", len(sq2.TagFilterss), len(sq1.TagFilterss)) t.Fatalf("unexpected TagFilterss len; got %d; want %d", len(sq2.TagFilterss), len(sq1.TagFilterss))
} }
for ii := range sq1.TagFilterss { for ii := range sq1.TagFilterss {

View file

@ -92,7 +92,7 @@ func createBenchTable(b *testing.B, path string, startTimestamp int64, rowsPerIn
r.Value = value r.Value = value
} }
if err := tb.AddRows(rows); err != nil { if err := tb.AddRows(rows); err != nil {
b.Fatalf("cannot add %d rows: %s", rowsPerInsert, err) panic(fmt.Errorf("cannot add %d rows: %s", rowsPerInsert, err))
} }
} }
wg.Done() wg.Done()