Project

General

Profile

Actions

Defect #5374

closed

repositories_controller queries SCM adapter even when all changes are cached in db

Added by Michael Vance over 14 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2010-04-22
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Latest/head version of redmine synced from edavis' Git mirror this morning, running on Windows Vista 64-bit, ruby 1.8.6 (2008-08-11 patchlevel 287), rails 2.3.5, sqlite3.

I have a remote repository which I access using a custom Perforce adapter I wrote for Redmine which is patterned on the Subversion adapter. Access to this repository is slow, and the repo has many changes/files, so local caching is important. However I've found that Redmine goes out to the repo even when auto-fetching is disabled. I put a breakpoint in my adapter's entries method and this is some of the relevant tidbits from the rdebug session:

(rdb:97) l
[74, 83] in D:/redmine/app/controllers/repositories_controller.rb
   74    end
   75
   76    def show
   77      @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
   78
=> 79      @entries = @repository.entries(@path, @rev)
   80      if request.xhr?
   81        @entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
   82      else
   83        (show_error_not_found; return) unless @entries
(rdb:97) p Setting.autofetch_changesets?
false
(rdb:97) bt
    #0 Redmine::Scm::Adapters::PerforceAdapter.entries(path#String, identifier#NilClass,...)
       at line D:/redmine/lib/redmine/scm/adapters/perforce_adapter.rb:68
    #1 Repository.entries(path#String, identifier#NilClass)
       at line D:/redmine/app/models/repository.rb:63
    #2 Kernel.send(method#Symbol, args#Array)
       at line C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:217
    #3 ActiveRecord::Associations::AssociationProxy.method_missing
       at line C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/associations/association_proxy.rb:217
--> #4 RepositoriesController.show
       at line D:/redmine/app/controllers/repositories_controller.rb:79
[etc.]

The slightly wonky thing (to me) is that the model (eg app/models/repository/perforce.rb in my case, but again patterned off of the svn adapter which does the same thing) in fetch_changesets does its own caching; it checks latest scm vs db revision and only grabs more if its been updated (and this works properly). But the repositories_controller invokes the scm adapter directly from what I can tell. So my question is, am I missing something obvious in my adapter implementation (doesn't seem likely, I've basically mirrored the svn implementation), or is this a defect in the general relationship between the controller/model/and adapters? I've also attached a snippet from the log file that shows the output in development. Thanks!


Files

redmine-p4-log.txt (3.89 KB) redmine-p4-log.txt Michael Vance, 2010-04-22 20:42
redmine-about.txt (654 Bytes) redmine-about.txt Michael Vance, 2010-04-22 20:47
Actions #1

Updated by Michael Vance over 14 years ago

Adding script/about per edavis.

Actions #2

Updated by Jean-Philippe Lang over 14 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

Changeset caching is mainly used by the search engine. When you browse a Subversion repository, there are some queries on the repository to get directory content and history log.

Actions #3

Updated by Toshi MARUYAMA over 12 years ago

  • Category set to SCM
Actions

Also available in: Atom PDF