1. Intro to Lab 4
We are going to talk a little about the next lab assignment, the
Heap File structure, and then we are going to look at the
code and get started on one of
HeapFile methods together.
In implementing the HeapFile class, you will need to interct with the BufferManager layer and the HeapPage class methods. Refer to both these class' documentation as you design, implement, and test your code:
We will start with adding a helper function,
does the recasting of the raw Page data of the file’s header page to
HeapFileHeader * and returns its value, or returns nullptr if there
is not header page. It is described in section
desribed in Section 4.3.1 of the lab write up.
Then, we will start on the design for
insertRecord together. It is
desribed in Section 4.3 of the lab write up.
2. Reminder of Some resources that will help with Lab 4:
Look at the SwatDB Exceptions documentation off the SwatDB info page. It has examples of throwing and catching SwatDB exceptions, and links to the exception class documentation.
Refer to the Lab assignment page often for information, tips, about implementing and testing your solution.
Refer to the Testing part of the assignment page for some testing tips. Look at the note about the print methods of the BufferManager class to print out information about its state. You can call these from any of the test programs, or from within gdb.
Refer to the Details part of the assignment page for more verbose information about the methods you need to implement.
Also, look at
heapfile.hfor types, parameters, return values, and the SwatDB section for links to documetnation on other parts of SwatDB that is particularly useful for this lab (
Use gdb to debug your code. If you don’t know what a method you wrote is doing, run the test program (
checkpt) in gdb, set break points in HeapPage methods and examine runtime state.
Use valgrind to make sure any bugs you have are not due to memory access errors.
Weekly lab pages related to SwatDB, and SwatDB debugging and testing
3. C++ Reminders
In particular, if you are still a bit rusty using
take some time to review them again so you are comfortable using
them to debug this lab. It will save you hours and hours of debugging
time to uses these tools, and we will ask you what you discovered
valgrind about bugs you have in your program that you
want us to help you with--we expect that you are using
valgrind to debug.
The Lab 4: SwatDB Heap File assignment page has links to all kinds of C++ programming resources.