Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
state/presence: Make beings docs smaller #7230
Conversation
jameinel
approved these changes
Apr 12, 2017
I think this is good as is if we just wanted to land it. I have some thoughts about things we could improve, and I wonder if we want to add an "Upgrade" step to remove it from active databases. But I think you mentioned an upgrade step that just drops everything in presence anyway, which would certainly have the desired effect.
| + beings := make([]beingInfo, 0) | ||
| + err := beingsC.Find(bson.M{ | ||
| + "_id": bson.M{"$regex": bson.RegEx{"^" + w.modelUUID, ""}}, | ||
| + }).All(&beings) |
jameinel
Apr 12, 2017
Owner
given this table is larger than we think it is, should we be actually using BatchSize and Iter() to load it into the map?
| if err != nil { | ||
| return nil, err | ||
| } | ||
| + dt := time.Now().Sub(t0) | ||
| + logger.Tracef("[%s] loaded %d beings in %s", w.modelUUID[:6], len(beings), dt) |
jameinel
Apr 12, 2017
Owner
this feels like it might be worthy for Debug. Trace is always something that "you have to know it exists to turn it on", whereas "Debug" is "would it be useful to get this sort of information from the field".
mjs
added some commits
Apr 12, 2017
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
|
Build failed: Tests failed |
|
$$unrelated-lxd-weirdness$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
mjs commentedApr 12, 2017
•
Edited 1 time
-
mjs
Apr 12, 2017
Description of change
There is no need to stored the model-uuid separately as it's already
in the _id prefix. The query on model-uuid can be replaced with a
prefix match on _id (this uses the index on _id).
Given that many beings documents are created this as a significant
impact on disk space usage.
QA steps
Bootstrapped a controller with a few units and models and confirmed that presence still functions. Confirmed new log message works like this:
Documentation changes
N.A. (internal only)
Bug reference
Contributes to fixing https://bugs.launchpad.net/juju/+bug/1454661