From: Sebastian B. <sb...@us...> - 2014-01-19 18:39:05
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23343 Modified Files: index_external.c Log Message: Determine the index (and lchild) via information stored in the btree path. When we go up to the root after a node became full, we use now the information stored in the bnode path. The old variant is still there, but will vanish soon. Index: index_external.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/index_external.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- index_external.c 19 Jan 2014 18:38:19 -0000 1.20 +++ index_external.c 19 Jan 2014 18:39:02 -0000 1.21 @@ -27,6 +27,7 @@ * times from the external media. */ +#include <assert.h> #include <errno.h> #include <stdlib.h> #include <stdio.h> @@ -477,11 +478,16 @@ lchild = tmp->lchild; i = 0; - /* Find the separation key whose left child points to the splitted block */ for (i=0; i<tmp->num_elements && lchild != block; i++) lchild = bnode_get_ith_element_of_node(idx, tmp, i)->gchild; + assert(lchild == path.node[current_level].block); + assert(i == path.node[current_level - 1].key_index); + + lchild = path.node[current_level].block; + i = path.node[current_level - 1].key_index; + if (tmp->num_elements == idx->max_elements_per_node) { fprintf(stderr, "Splitting a non-direct-child of the root node %d is not supported for now!\n", block); |