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

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed May 20, 2018
1 parent e3c1aed commit 0b2b286
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
19 changes: 9 additions & 10 deletions mdata/cache/ccache.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,21 @@ func (c *CCache) evict(target *accnt.EvictTarget) {
func (c *CCache) Search(ctx context.Context, metric schema.AMKey, from, until uint32) (*CCSearchResult, error) {
ctx, span := tracing.NewSpan(ctx, c.tracer, "CCache.Search")
defer span.Finish()
var hit chunk.IterGen
var cm *CCacheMetric
var ok bool
res := &CCSearchResult{
From: from,
Until: until,
}

if from >= until {
return nil, ErrInvalidRange
}

res := &CCSearchResult{
From: from,
Until: until,
}

c.RLock()
defer c.RUnlock()

if cm, ok = c.metricCache[metric]; !ok {
cm, ok := c.metricCache[metric]
if !ok {
span.SetTag("cache", "miss")
accnt.CacheMetricMiss.Inc()
return res, nil
Expand All @@ -233,10 +232,10 @@ func (c *CCache) Search(ctx context.Context, metric schema.AMKey, from, until ui

accnt.CacheChunkHit.Add(len(res.Start) + len(res.End))
go func() {
for _, hit = range res.Start {
for _, hit := range res.Start {
c.accnt.HitChunk(metric, hit.Ts)
}
for _, hit = range res.End {
for _, hit := range res.End {
c.accnt.HitChunk(metric, hit.Ts)
}
}()
Expand Down
2 changes: 1 addition & 1 deletion store/cassandra/store_cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Month_sec = 60 * 60 * 24 * 28
const Table_name_format = `metric_%d`

var (
errChunkTooSmall = errors.New("unpossibly small chunk in cassandra")
errChunkTooSmall = errors.New("impossibly small chunk in cassandra")
errInvalidRange = errors.New("CassandraStore: invalid range: from must be less than to")
errReadQueueFull = errors.New("the read queue is full")
errReadTooOld = errors.New("the read is too old")
Expand Down

0 comments on commit 0b2b286

Please sign in to comment.