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
=== modified file 'loggerhead/history_db.py'
--- loggerhead/history_db.py 2010-07-07 20:09:44 +0000
+++ loggerhead/history_db.py 2011-01-27 20:34:53 +0000
@@ -1,4 +1,4 @@
1# Copyright (C) 2010 Canonical Ltd1# Copyright (C) 2010, 2011 Canonical Ltd
2#2#
3# This program is free software; you can redistribute it and/or modify3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by4# it under the terms of the GNU General Public License as published by
@@ -121,7 +121,7 @@
121 trace.note('history_db initialized database')121 trace.note('history_db initialized database')
122 # We know we can't do this incrementally, because nothing has122 # We know we can't do this incrementally, because nothing has
123 # existed before...123 # existed before...
124 #self._incremental = False124 self._incremental = False
125125
126 def _ensure_revisions(self, revision_ids):126 def _ensure_revisions(self, revision_ids):
127 schema.ensure_revisions(self._cursor, revision_ids,127 schema.ensure_revisions(self._cursor, revision_ids,

Subscribers

People subscribed via source and target branches