~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

(jameinel) Allow 'bzr serve' to interpret SIGHUP as a graceful shutdown.
 (bug #795025) (John A Meinel)

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
 
 
22
20
import cStringIO
23
21
 
24
22
from bzrlib.lazy_import import lazy_import
296
294
            flag when writing out. This is used by the _spill_mem_keys_to_disk
297
295
            functionality.
298
296
        """
299
 
        new_leaf = False
300
297
        if rows[-1].writer is None:
301
298
            # opening a new leaf chunk;
302
 
            new_leaf = True
303
299
            for pos, internal_row in enumerate(rows[:-1]):
304
300
                # flesh out any internal nodes that are needed to
305
301
                # preserve the height of the tree
324
320
                optimize_for_size=self._optimize_for_size)
325
321
            rows[-1].writer.write(_LEAF_FLAG)
326
322
        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)
332
323
            # this key did not fit in the node:
333
324
            rows[-1].finish_node()
334
325
            key_line = string_key + "\n"