~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Patch Queue Manager
  • Date: 2015-12-17 18:39:00 UTC
  • mfrom: (6606.1.2 fix-float)
  • Revision ID: pqm@pqm.ubuntu.com-20151217183900-0719du2uv1kwu3lc
(vila) Inline testtools private method to fix an issue in xenial (the
 private implementation has changed in an backward incompatible way).
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""B+Tree indices"""
19
19
 
 
20
from __future__ import absolute_import
 
21
 
20
22
import cStringIO
21
23
 
22
24
from bzrlib.lazy_import import lazy_import
294
296
            flag when writing out. This is used by the _spill_mem_keys_to_disk
295
297
            functionality.
296
298
        """
 
299
        new_leaf = False
297
300
        if rows[-1].writer is None:
298
301
            # opening a new leaf chunk;
 
302
            new_leaf = True
299
303
            for pos, internal_row in enumerate(rows[:-1]):
300
304
                # flesh out any internal nodes that are needed to
301
305
                # preserve the height of the tree
320
324
                optimize_for_size=self._optimize_for_size)
321
325
            rows[-1].writer.write(_LEAF_FLAG)
322
326
        if rows[-1].writer.write(line):
 
327
            # if we failed to write, despite having an empty page to write to,
 
328
            # then line is too big. raising the error avoids infinite recursion
 
329
            # searching for a suitably large page that will not be found.
 
330
            if new_leaf:
 
331
                raise errors.BadIndexKey(string_key)
323
332
            # this key did not fit in the node:
324
333
            rows[-1].finish_node()
325
334
            key_line = string_key + "\n"