CS44 B+Tree Lab Example Output

Below are example output from my testing my own B+Tree implementation. It shows some runs with calls to printTree and some other output in the test functions. Your printTree output does not have to look like mine.

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:

  1. one is very much like test0, but it takes a parameter which is the number of tuples to create the relation file with (you need to pass this value to any function like createForward too).
  2. The other one is like test0, but it tests constructing a BTreeIndex from an existing B+Tree index file (it first creates it, then closes and deletes File and BTreeIndex objects), then creates a new BTreeIndex from the index file just created.
I've also added to my main.cpp program command line aguments that let me specify the number of tuples to add to the relation, and which of the two tests above I want to run. I suggest adding the command line option to specify the number of tuples to add. It makes testing splitting leaf and internal nodes easier (you don't have to edit main.cpp and recompile just to change the size of the relation).

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 | 
           | 0 
					
Output 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