Skip to content

Commit

Permalink
Merge pull request #519 from rogpeppe/168-more-indexes
Browse files Browse the repository at this point in the history
internal/charmstore: add more indexes

This should solve some performance issues.
  • Loading branch information
jujugui committed Jan 26, 2016
2 parents ef8e5e8 + 9d697a8 commit b376d6e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions internal/charmstore/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,19 @@ func (s *Store) ensureIndexes() error {
}, {
s.DB.Entities(),
mgo.Index{Key: []string{"bundlecharms"}},
}, {
s.DB.Entities(),
mgo.Index{Key: []string{"name", "development", "-promulgated-revision", "-supportedseries"}},
}, {
s.DB.Entities(),
mgo.Index{Key: []string{"name", "development", "user", "-revision", "-supportedseries"}},
}, {
s.DB.BaseEntities(),
mgo.Index{Key: []string{"name"}},
}, {
// TODO this index should be created by the mgo gridfs code.
s.DB.C("entitystore.files"),
mgo.Index{Key: []string{"filename"}},
}}
for _, idx := range indexes {
err := idx.c.EnsureIndex(idx.i)
Expand Down
2 changes: 1 addition & 1 deletion internal/charmstore/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ func (s *StoreSuite) TestCollections(c *gc.C) {
}
// Check that all created collections are mentioned in Collections.
for _, name := range names {
if name == "system.indexes" || name == "managedStoredResources" {
if name == "system.indexes" || name == "managedStoredResources" || name == "entitystore.files" {
continue
}
found := false
Expand Down

0 comments on commit b376d6e

Please sign in to comment.