These are runs with DEBUG set (the number of key entires per page is 8).
I'm showing you output from runs of two test programs I've added:
Runs of a test program I wrote to test splitting, main is changed to take a command line argument specifying the number of tuples to create in the associated relation file (runs for 10 and 40):
./wiscdb_main 10 leaf size:8 non-leaf size:8 --------------------- Create Relation 10 tuples Create new B+Tree index on relation --------------------- Resulting Index: ***Level: 1 pageId: 2 3 | 00000 stri | 4 | 00005 stri | 5 Leaf pageId: 3 | | 4 Leaf pageId: 4 | 00000 stri | 00001 stri | 00002 stri | 00003 stri | 00004 stri | | 5 Leaf pageId: 5 | 00005 stri | 00006 stri | 00007 stri | 00008 stri | 00009 stri | | 0 ./wiscdb_main 40 leaf size:8 non-leaf size:8 --------------------- Create Relation 40 tuples Create new B+Tree index on relation --------------------- Resulting Index: ***Level: 1 pageId: 2 3 | 00000 stri | 4 | 00005 stri | 5 | 00010 stri | 6 | 00015 stri | 7 | 00020 stri | 8 | 00025 stri | 9 | 00030 stri | 10 | 00035 stri | 11 Leaf pageId: 3 | | 4 Leaf pageId: 4 | 00000 stri | 00001 stri | 00002 stri | 00003 stri | 00004 stri | | 5 Leaf pageId: 5 | 00005 stri | 00006 stri | 00007 stri | 00008 stri | 00009 stri | | 6 Leaf pageId: 6 | 00010 stri | 00011 stri | 00012 stri | 00013 stri | 00014 stri | | 7 Leaf pageId: 7 | 00015 stri | 00016 stri | 00017 stri | 00018 stri | 00019 stri | | 8 Leaf pageId: 8 | 00020 stri | 00021 stri | 00022 stri | 00023 stri | 00024 stri | | 9 Leaf pageId: 9 | 00025 stri | 00026 stri | 00027 stri | 00028 stri | 00029 stri | | 10 Leaf pageId: 10 | 00030 stri | 00031 stri | 00032 stri | 00033 stri | 00034 stri | | 11 Leaf pageId: 11 | 00035 stri | 00036 stri | 00037 stri | 00038 stri | 00039 stri | | 0Output from runs of my second test function that tests creating from existing B+Tree file: (these have one debug print statement in my BTreeIndex constructor indicating which mode the constructor is operating in)
./wiscdb_main 10 1 leaf size:8 non-leaf size:8 --------------------- Create Relation of 10 tuples Create or re-open B+Tree index on relation BTreeIndex::BTreeIndex: creating a new index header page id 1 root page id 2 --------------------- Resulting Index: ***Level: 1 pageId: 2 3 | 00000 stri | 4 | 00005 stri | 5 Leaf pageId: 3 | | 4 Leaf pageId: 4 | 00000 stri | 00001 stri | 00002 stri | 00003 stri | 00004 stri | | 5 Leaf pageId: 5 | 00005 stri | 00006 stri | 00007 stri | 00008 stri | 00009 stri | | 0 reopen indexrelA.16: relA Create or re-open B+Tree index on relation BTreeIndex::BTreeIndex: creating from existing index: relA.16 --------------------- Resulting Index: ***Level: 1 pageId: 2 3 | 00000 stri | 4 | 00005 stri | 5 Leaf pageId: 3 | | 4 Leaf pageId: 4 | 00000 stri | 00001 stri | 00002 stri | 00003 stri | 00004 stri | | 5 Leaf pageId: 5 | 00005 stri | 00006 stri | 00007 stri | 00008 stri | 00009 stri | | 0 ./wiscdb_main 40 1 leaf size:8 non-leaf size:8 --------------------- Create Relation of 40 tuples Create or re-open B+Tree index on relation BTreeIndex::BTreeIndex: creating a new index header page id 1 root page id 2 --------------------- Resulting Index: ***Level: 1 pageId: 2 3 | 00000 stri | 4 | 00005 stri | 5 | 00010 stri | 6 | 00015 stri | 7 | 00020 stri | 8 | 00025 stri | 9 | 00030 stri | 10 | 00035 stri | 11 Leaf pageId: 3 | | 4 Leaf pageId: 4 | 00000 stri | 00001 stri | 00002 stri | 00003 stri | 00004 stri | | 5 Leaf pageId: 5 | 00005 stri | 00006 stri | 00007 stri | 00008 stri | 00009 stri | | 6 Leaf pageId: 6 | 00010 stri | 00011 stri | 00012 stri | 00013 stri | 00014 stri | | 7 Leaf pageId: 7 | 00015 stri | 00016 stri | 00017 stri | 00018 stri | 00019 stri | | 8 Leaf pageId: 8 | 00020 stri | 00021 stri | 00022 stri | 00023 stri | 00024 stri | | 9 Leaf pageId: 9 | 00025 stri | 00026 stri | 00027 stri | 00028 stri | 00029 stri | | 10 Leaf pageId: 10 | 00030 stri | 00031 stri | 00032 stri | 00033 stri | 00034 stri | | 11 Leaf pageId: 11 | 00035 stri | 00036 stri | 00037 stri | 00038 stri | 00039 stri | | 0 reopen indexrelA.16: relA Create or re-open B+Tree index on relation BTreeIndex::BTreeIndex: creating from existing index: relA.16 --------------------- Resulting Index: ***Level: 1 pageId: 2 3 | 00000 stri | 4 | 00005 stri | 5 | 00010 stri | 6 | 00015 stri | 7 | 00020 stri | 8 | 00025 stri | 9 | 00030 stri | 10 | 00035 stri | 11 Leaf pageId: 3 | | 4 Leaf pageId: 4 | 00000 stri | 00001 stri | 00002 stri | 00003 stri | 00004 stri | | 5 Leaf pageId: 5 | 00005 stri | 00006 stri | 00007 stri | 00008 stri | 00009 stri | | 6 Leaf pageId: 6 | 00010 stri | 00011 stri | 00012 stri | 00013 stri | 00014 stri | | 7 Leaf pageId: 7 | 00015 stri | 00016 stri | 00017 stri | 00018 stri | 00019 stri | | 8 Leaf pageId: 8 | 00020 stri | 00021 stri | 00022 stri | 00023 stri | 00024 stri | | 9 Leaf pageId: 9 | 00025 stri | 00026 stri | 00027 stri | 00028 stri | 00029 stri | | 10 Leaf pageId: 10 | 00030 stri | 00031 stri | 00032 stri | 00033 stri | 00034 stri | | 11 Leaf pageId: 11 | 00035 stri | 00036 stri | 00037 stri | 00038 stri | 00039 stri | | 0