~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chk_map.py

  • Committer: Robert Collins
  • Date: 2010-01-29 15:18:58 UTC
  • mto: (4797.2.8 2.1)
  • mto: This revision was merged to the branch mainline in revision 4998.
  • Revision ID: robertc@robertcollins.net-20100129151858-0c1m88b013wluaxn
Introduce a threading.local to isolate the chk_map page cache from other threads.

Show diffs side-by-side

added added

removed removed

Lines of Context:
905
905
        # Unmapping the new node will check the existing nodes to see if they
906
906
        # would fit.
907
907
        # Clear the page cache so we ensure we have to read all the children
908
 
        chk_map._page_cache.clear()
 
908
        chk_map.clear_cache()
909
909
        chkmap.unmap(('aad',))
910
910
        self.assertIsInstance(chkmap._root_node._items['aaa'], LeafNode)
911
911
        self.assertIsInstance(chkmap._root_node._items['aab'], LeafNode)
945
945
        # Now clear the page cache, and only include 2 of the children in the
946
946
        # cache
947
947
        aab_key = chkmap._root_node._items['aab']
948
 
        aab_bytes = chk_map._page_cache[aab_key]
 
948
        aab_bytes = chk_map._get_cache()[aab_key]
949
949
        aac_key = chkmap._root_node._items['aac']
950
 
        aac_bytes = chk_map._page_cache[aac_key]
951
 
        chk_map._page_cache.clear()
952
 
        chk_map._page_cache[aab_key] = aab_bytes
953
 
        chk_map._page_cache[aac_key] = aac_bytes
 
950
        aac_bytes = chk_map._get_cache()[aac_key]
 
951
        chk_map.clear_cache()
 
952
        chk_map._get_cache()[aab_key] = aab_bytes
 
953
        chk_map._get_cache()[aac_key] = aac_bytes
954
954
 
955
955
        # Unmapping the new node will check the nodes from the page cache
956
956
        # first, and not have to read in 'aaa'