Patch #6159

Subversion: latest changesets performance improvement.

Added by Go MAEDA about 7 years ago. Updated over 6 years ago.

Status:NewStart date:2010-08-17
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:-

Description

Redmine executes "svn log" command 2 times (Repository::Subversion#fetch_changesets and Repository::Subversion#latest_changesets) when performing repository/show action. As a result, it takes very long time to complete when the repository is on remote server.

This patch improves performance of the Subversion#latest_changesets method by querying changesets table on the database instead of executing "svn log" command.

svn_latest_changesets_improvement.diff Magnifier (1.13 KB) Go MAEDA, 2010-08-17 16:28

latest-changesets-improvements.diff Magnifier (2.79 KB) Yuya Nishihara, 2010-08-19 16:21

latest-changesets-improvements-2.diff Magnifier (2.82 KB) Yuya Nishihara, 2010-08-19 17:10

latest-changesets-improvements-3.diff Magnifier (2.12 KB) Enrique Garcia, 2010-11-16 16:33

latest-changesets-improvements-4.diff Magnifier (2.94 KB) Toshi MARUYAMA, 2010-11-30 07:18

svn-before-patch.png (124 KB) Toshi MARUYAMA, 2010-11-30 07:18

svn-after-patch.png (105 KB) Toshi MARUYAMA, 2010-11-30 07:18

bazaar-before-patch.png (51.3 KB) Toshi MARUYAMA, 2010-11-30 07:18

bazaar-after-patch.png (61.1 KB) Toshi MARUYAMA, 2010-11-30 07:18


Related issues

Related to Redmine - Defect #7984: Confusing revisions links on repository root New 2011-03-24
Related to Redmine - Feature #7246: Handle "named branch" for mercurial Closed 2011-01-07
Related to Redmine - Feature #1311: Subversion: Show revision histories for branches New 2008-05-27
Related to Redmine - Defect #3943: Subversion: Directory revision list contains faulty revis... New 2009-09-29
Related to Redmine - Patch #7528: Fetch small initial set of repository changesets New 2011-02-03
Related to Redmine - Feature #7719: SVN Start Revision New 2011-02-25

Associated revisions

Revision 4797
Added by Toshi MARUYAMA over 6 years ago

scm: change key name of configurable command name (#7517, #6159, #7047).

Revision 4868
Added by Toshi MARUYAMA over 6 years ago

scm: mercurial: improvement latest_changesets without supporting tags and named branches (#4455).

Based on latest-changesets-improvements-2.diff of #6159.
http://www.redmine.org/attachments/4332/latest-changesets-improvements-2.diff

Contributed by Yuya Nishihara.

History

#1 Updated by Yuya Nishihara about 7 years ago

How about fixing Repository.latest_changesets, then makes use of it?
See latest-changesets-improvements.diff

app/models/repository.rb:
  • filter by changes.path = "..." OR changes.path LIKE ".../%".
  • JOIN changes for path condition; then SELECT DISTINCT changesets.* to strip duplicated records.
  • ORDER BY statement are declared by has_many :changesets, :order => ..., so no need to specify explicitly.
app/models/repository/subversion.rb:
  • use Repository.latest_changesets

#2 Updated by Yuya Nishihara about 7 years ago

Yuya Nishihara wrote:

See latest-changesets-improvements.diff

Oops, it has a bug on escaping LIKE pattern. Fixed as latest-changesets-improvements-2.diff

#3 Updated by Enrique Garcia almost 7 years ago

Updated Yuya's patch so it uses relative paths for easy patching

(see latest-changesets-improvements-3.diff)

Usage:

cd path/to/your/redmine
patch -p0 < latest-changesets-improvements-3.diff

#4 Updated by Toshi MARUYAMA almost 7 years ago

I have updated Yuya's patch as latest-changesets-improvements-4.diff.

Usage:

cd path/to/your/redmine
patch -p1 < latest-changesets-improvements-4.diff

The reasons of updating are following.

  • Subversion latest_changesets switches "file://" or not.
  • Add Mercurial ordering to resolve #3449 and #3567

Subversion latest_changesets switches "file://" or not

Redmine 1.0.4 shows all revisions of branch and tag.
For example, http://www.redmine.org/projects/redmine/repository/show/tags/1.0.4 shows
r4448 (tagged version 1.0.4), r4447, r4445...
But Yuya's patch shows only r4448.

I have updated as following.

  • "file://": use "svn log"
  • The others: use only database

It maybe better to be configurable whether using "svn log" or "only database" such as note-5 of #6092.

Improvement of browsing sub directory for other SCMs

This patch improves other SCMs which does not override latest_changesets.
Other SCMs are CVS, Bazaar, Darcs and Mercurial.
Subversion and Git overrides latest_changesets.

Redmine 1.0.4 does not show "latest revisions" of sub directory.
This patch shows it.

Following images are Bazaar images of test repository (source:tags/1.0.4/test/fixtures/repositories/bazaar_repository.tar.gz) .

Mercurial ordering

Yuya's hg-changeset-order.patch of #4455 overrides Mercurial latest_changesets and add "order by id DESC" to resolve #3449 and #3567.
But, if we apply this patch, we do not need to override it.

#5 Updated by 후지 이 almost 7 years ago

한글로 수정합니다.

#6 Updated by 후지 이 almost 7 years ago

레퍼런스를 관리합니다.

#7 Updated by Toshi MARUYAMA almost 7 years ago

  • Subject changed from Repository::Subversion#latest_changesets performance inprovement. to Repository::Subversion#latest_changesets performance improvement.

Fix subject typo.

#8 Updated by Toshi MARUYAMA over 6 years ago

  • Subject changed from Repository::Subversion#latest_changesets performance improvement. to Subversion: latest changesets performance improvement.

Also available in: Atom PDF