~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_btree_index.py

  • Committer: John Arbash Meinel
  • Date: 2009-03-23 19:35:38 UTC
  • mto: This revision was merged to the branch mainline in revision 4187.
  • Revision ID: john@arbash-meinel.com-20090323193538-3d01aetz07jsyd3w
Add 'combine_backing_indices' as a flag for GraphIndex.set_optimize().

Update the Packer code so that it sets combine_backing_indices=False, as we know that
we won't be making extra queries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
433
433
 
434
434
    def test_spill_index_stress_1_1_no_combine(self):
435
435
        builder = btree_index.BTreeBuilder(key_elements=1, spill_at=2)
436
 
        builder._combine_spilled_indices = False
 
436
        builder.set_optimize(for_size=False, combine_backing_indices=False)
437
437
        nodes = [node[0:2] for node in self.make_nodes(16, 1, 0)]
438
438
        builder.add_node(*nodes[0])
439
439
        # Test the parts of the index that take up memory are doing so
510
510
        self.assertTrue(builder._optimize_for_size)
511
511
        builder.set_optimize(for_size=False)
512
512
        self.assertFalse(builder._optimize_for_size)
 
513
        # test that we can set combine_backing_indices without effecting
 
514
        # _optimize_for_size
 
515
        obj = object()
 
516
        builder._optimize_for_size = obj
 
517
        builder.set_optimize(combine_backing_indices=False)
 
518
        self.assertFalse(builder._combine_backing_indices)
 
519
        self.assertIs(obj, builder._optimize_for_size)
 
520
        builder.set_optimize(combine_backing_indices=True)
 
521
        self.assertTrue(builder._combine_backing_indices)
 
522
        self.assertIs(obj, builder._optimize_for_size)
513
523
 
514
524
    def test_spill_index_stress_2_2(self):
515
525
        # test that references and longer keys don't confuse things.