add operation discards hashcache stat information

Bug #146176 reported by Martin Pool
2
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
High
Martin Pool

Bug Description

  affects bzr
  importance high
  status inprogress

(supersedes bug 145511)

This sequence of operations:

 bzr status
 bzr add
 bzr status

The second status operation reads and hashes every file, unnecessarily,
and so is slow. add shouldn't cause those stat values to be
invalidated.

This may likely be that DirState.set_state_from_inventory
is discarding the working tree information.

If that's true there are two ways to fix it:

 - change add to work on the tree, rather than converting to and from
   an inventory (bug 146165)

 - update this method to retain wt cached information

or both.

--
Martin Pool

Revision history for this message
John A Meinel (jameinel) wrote :

It isn't just add. I believe 'commit' does as well. Anything that has reason to "set_state_from_inventory". I originally thought "set_parent_trees" was also to blame, but it looks like that does not discard the stat information.

I think having a short-term fix of updating set_state_from_inventory means that we will fix more than just 'bzr add' and it is worth doing.

Revision history for this message
John A Meinel (jameinel) wrote :

Just to clarify, I believe "bzr update" suffers from the same bug. As does probably 'bzr merge' and 'bzr pull'. They just aren't used as often as 'bzr add'.

Revision history for this message
Martin Pool (mbp) wrote : john writes

See title. Just a thought.

By the way, I've updated my bzr.dev with the attached patch. You may not
want the "packed stat mismatch" because that gets pretty verbose, but it
is nice to see:

marking dirstate dirty because cache miss on: d
/home/jameinel/dev/private/sp2bzr/gtk/with_file_info/

or

% bzr remove --force X
marking dirstate dirty because of set_state_from_inventory

Also, I can see that we need to remove the size value from directories,
because it causes unnecessary churn in the dirstate. (I imagine that
adding an ignored file will cause the cache to miss for that directory,
and force us to rewrite the dirstate.)

Changed in bzr:
assignee: nobody → mbp
Revision history for this message
Martin Pool (mbp) wrote :
Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 146176] Re: add operation discards hashcache stat information

On Wed, 2007-10-03 at 22:39 +0000, Martin Pool wrote:
> ** Attachment added: "dirty_dirstate.diff"
> http://launchpadlibrarian.net/9714529/dirty_dirstate.diff

unpack_stat in that patch is unused and shouldn't be needed. FWIW>

-Rob

--
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Revision history for this message
Martin Pool (mbp) wrote :

Merged for 0.92

Changed in bzr:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.