Merge lp:~jameinel/loggerhead/incremental_import into lp:loggerhead

Proposed by John A Meinel
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: 447
Merged at revision: 447
Proposed branch: lp:~jameinel/loggerhead/incremental_import
Merge into: lp:loggerhead
Diff against target: 18 lines (+2/-2)
1 file modified
loggerhead/history_db.py (+2/-2)
To merge this branch: bzr merge lp:~jameinel/loggerhead/incremental_import
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+47722@code.launchpad.net

Commit message

When creating the history.db cache file, do a non-incremental import.

Description of the change

This reactivates a heuristic for the history-db import logic.

This makes first-time import a lot faster.

The idea is:

a) Most of the time, the cache is already populated, so you don't want to load the whole ancestry of a branch. Just to only import the last few revisions.

b) However, if you are creating the database file, you *know* that you have to import the whole ancestry.

c) bzrlib has special apis to make "give me the whole ancestry" faster. It is something we avoid doing, but when you need it, you have it. Those apis also use a Pyrex extension to compute a lot of the data that we recompute on-the-fly in the incremental case.

In the case of doing 'bzr serve --http' on a Launchpad tree, it drops the time for the first page view from about 19s down to about 11-12s (the target is the ~6-7s that the non-history-db code took).

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loggerhead/history_db.py'
2--- loggerhead/history_db.py 2010-07-07 20:09:44 +0000
3+++ loggerhead/history_db.py 2011-01-27 20:34:53 +0000
4@@ -1,4 +1,4 @@
5-# Copyright (C) 2010 Canonical Ltd
6+# Copyright (C) 2010, 2011 Canonical Ltd
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10@@ -121,7 +121,7 @@
11 trace.note('history_db initialized database')
12 # We know we can't do this incrementally, because nothing has
13 # existed before...
14- #self._incremental = False
15+ self._incremental = False
16
17 def _ensure_revisions(self, revision_ids):
18 schema.ensure_revisions(self._cursor, revision_ids,

Subscribers

People subscribed via source and target branches