You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/10/02 23:30:28 UTC
[12/34] git commit: [#5024] add a hint and limit to last_post query
[#5024] add a hint and limit to last_post query
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fbf2b309
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fbf2b309
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fbf2b309
Branch: refs/heads/db/4968
Commit: fbf2b30979bab640cd4ec4934ee3ac056e01323c
Parents: fffbaa7
Author: Dave Brondsema <db...@geek.net>
Authored: Mon Oct 1 19:59:42 2012 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Mon Oct 1 20:57:45 2012 +0000
----------------------------------------------------------------------
Allura/allura/command/show_models.py | 6 ++++++
Allura/allura/model/discuss.py | 7 ++++++-
requirements-common.txt | 2 +-
3 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fbf2b309/Allura/allura/command/show_models.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/show_models.py b/Allura/allura/command/show_models.py
index e013644..95558ec 100644
--- a/Allura/allura/command/show_models.py
+++ b/Allura/allura/command/show_models.py
@@ -145,6 +145,12 @@ class EnsureIndexCommand(base.Command):
base.log.info('... DB: %s', db)
for name, indexes in project_indexes.iteritems():
self._update_indexes(db[name], indexes)
+ if not configured_dbs:
+ # e.g. during bootstrap with no projects
+ db = M.project_doc_session.db
+ base.log.info('... default DB: %s', db)
+ for name, indexes in project_indexes.iteritems():
+ self._update_indexes(db[name], indexes)
base.log.info('Done updating indexes')
def _update_indexes(self, collection, indexes):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fbf2b309/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index 0f6fcf1..136d2c8 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -73,7 +73,12 @@ class Discussion(Artifact, ActivityObject):
@LazyProperty
def last_post(self):
q = self.post_class().query.find(dict(
- discussion_id=self._id)).sort('timestamp', pymongo.DESCENDING)
+ discussion_id=self._id))\
+ .sort('timestamp', pymongo.DESCENDING)\
+ .limit(1)\
+ .hint([('discussion_id', pymongo.ASCENDING)])
+ # hint is to try to force the index to be used, since mongo wouldn't select it sometimes
+ # https://groups.google.com/forum/#!topic/mongodb-user/0TEqPfXxQU8
return q.first()
def url(self):
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fbf2b309/requirements-common.txt
----------------------------------------------------------------------
diff --git a/requirements-common.txt b/requirements-common.txt
index c31ef06..0b52c0f 100644
--- a/requirements-common.txt
+++ b/requirements-common.txt
@@ -21,7 +21,7 @@ iso8601==0.1.4
Jinja2==2.6
Markdown==2.0.3
mercurial==1.4.3
-Ming==0.3.2dev-20120912
+Ming==0.3.2dev-20121001
oauth2==1.5.170
# tg2 dep PasteDeploy must specified before TurboGears2, to avoid a version/allow-hosts problem
Paste==1.7.5.1