Skip to content

Commit

Permalink
Propagate per-instance sizes to inner trees.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Mar 13, 2014
1 parent 7cc49df commit 2652a90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions BTrees/BTreeTemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,15 @@ BTree_grow(BTree *self, int index, int noval)

/* Now split between the original (v) and the new (e) at the midpoint*/
if (SameType_Check(self, v))
{
((BTree *)e)->max_btree_size = ((BTree *)v)->max_btree_size;
((BTree *)e)->max_bucket_size = ((BTree *)v)->max_bucket_size;
i = BTree_split((BTree *)v, -1, (BTree *)e);
}
else
{
i = bucket_split((Bucket *)v, -1, (Bucket *)e);
}
PER_ALLOW_DEACTIVATION(v);

if (i < 0)
Expand Down
5 changes: 3 additions & 2 deletions BTrees/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,8 +910,9 @@ def _split(self, index=None):
if index is None:
index = len(data) // 2

next = self.__class__()
next._data = data[index:]
next = self.__class__(max_btree_size=self._max_btree_size,
max_bucket_size=self._max_bucket_size)
next._data[:] = data[index:]
first = data[index]
del data[index:]
if len(data) == 0:
Expand Down

0 comments on commit 2652a90

Please sign in to comment.