-
Notifications
You must be signed in to change notification settings - Fork 105
Conversation
if |
idx/cassandra/cassandra.go
Outdated
@@ -390,6 +393,9 @@ func (c *CasIdx) Delete(orgId int, pattern string) ([]schema.MetricDefinition, e | |||
} | |||
|
|||
func (c *CasIdx) deleteDef(def *schema.MetricDefinition) error { | |||
if !updateCassIdx { | |||
return nil | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think checks like these should be executed in the caller, e.g. in the public functions, not the internal "worker" functions. This is also more efficient. E.g. In Prune we can simply skip the entire loop of many deleteDef calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my comments aside. I think this looks good. this will be very useful to deploy. I'm not sure if the 2nd "remove duplication" commit is still worth it once this is rebased on top of the changes that simplified the code already a bit. Note that you also need to update metrictank-sample.ini and then run scripts/sync-configs.sh
Cool, I'll update that. As a general question: If there are timing-stats collected about how long it takes to update the index, and cassandra index updates are disabled, should these stats still be collected even though now they only include the memory index updates? F.e: https://github.com/raintank/metrictank/blob/a4e8ff546c1a0c74c09cd938d72523ae0f4306ba/idx/cassandra/cassandra.go#L391 I think the should. Obviously the values will drop by a lot once cassandra doesn't need to be updated, but the stats are separated per instance anyway so they shouldn't skew the other results. |
fa12a97
to
3a49582
Compare
3a49582
to
972cfd8
Compare
this would be ready for review again |
docker/docker-cluster/metrictank.ini
Outdated
@@ -271,6 +271,8 @@ write-queue-size = 100000 | |||
max-stale = 0 | |||
#Interval at which the index should be checked for stale series. | |||
prune-interval = 3h | |||
# disable cassandra index updates (for read nodes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment is the inverse of what the option actually does.
suggestion:
# synchronize index changes to cassandra. not all your nodes need to do this.
idx/cassandra/cassandra.go
Outdated
c.writeQueue <- writeReq{recvTime: time.Now(), def: def} | ||
statAddDuration.Value(time.Since(pre)) | ||
|
||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two lines seem pointless
idx/cassandra/cassandra.go
Outdated
c.MemoryIdx.AddOrUpdateDef(def) | ||
c.writeQueue <- writeReq{recvTime: time.Now(), def: def} | ||
statUpdateDuration.Value(time.Since(pre)) | ||
updateIdx = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can replace 3 lines with one, if we do updateIdx = (existing.LastUpdate < oldest.Unix())
idx/cassandra/cassandra.go
Outdated
go c.processWriteQueue() | ||
if updateCassIdx { | ||
for i := 0; i < numConns; i++ { | ||
c.wg.Add(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can move this to before the loop and make it a single call: c.wg.Add(numConns)
Ok, updated everything as requested |
idx/cassandra/cassandra.go
Outdated
@@ -92,7 +92,7 @@ func ConfigSetup() *flag.FlagSet { | |||
casIdx.DurationVar(&timeout, "timeout", time.Second, "cassandra request timeout") | |||
casIdx.IntVar(&numConns, "num-conns", 10, "number of concurrent connections to cassandra") | |||
casIdx.IntVar(&writeQueueSize, "write-queue-size", 100000, "Max number of metricDefs allowed to be unwritten to cassandra") | |||
casIdx.BoolVar(&updateCassIdx, "update-cassandra-index", true, "disable cassandra index updates (for read nodes)") | |||
casIdx.BoolVar(&updateCassIdx, "update-cassandra-index", true, "synchronize index changes to cassandra. not all your nodes need to do this.") | |||
casIdx.DurationVar(&updateInterval, "update-interval", time.Hour*3, "frequency at which we should update the metricDef lastUpdate field.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should clarify that you can also get instant updates. here and in the config comments and docs.
in that case, what value should the user specify? 0s
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, just specify 0s
or any other unit. ok, i'll add that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the description there and in the example configs.
7f9ac15
to
b3541aa
Compare
ok if you can confirm '0s' works, then this LGTM . |
Looking good: I modified
Then I've set
Then I started MT and
Then I used
And I'm continuously getting the following output from the MT with
|
That's one part of #547