Skip to content

anydemo/simpledb

 
 

Repository files navigation

simple-db

Code for all 6.830 labs will be available in this repo. Once you have set up your class repo, you pull lab code from here.

Directions for Repo Setup

Directions can be here

Lab Submission

Instructions for labs (including how to submit answers) are here

simpledb

design

  • there is one HeapFile object for each table in the database(one table per HeapFile)

  • Each page in a HeapFile is arranged as a set of slots, each of which can hold one tuple (tuples for a given table in SimpleDB are all of the same size) (a set of slot per page, one tuple per slot)

  • In addition to these slots, each page has a header that consists of a bitmap with one bit per tuple slot(one bitmap per page,one bit per tuple/slot). If the bit corresponding to a particular tuple is 1, it indicates that the tuple is valid; if it is 0, the tuple is invalid (e.g., has been deleted or was never initialized.)(1:valid, 0:invalid)

  • Pages of HeapFile objects are of type HeapPage which implements the Page interface.

  • Pages are stored in the buffer pool but are read and written by the HeapFile class.

  • Each tuple requires tuple size * 8 bits for its content and 1 bit for the header. Thus, the number of tuples that can fit in a single page is: _tuples per page_ = floor((_page size_ * 8) / (_tuple size_ * 8 + 1))

  • the number of bytes required to store the header is simply: headerBytes = ceiling(tupsPerPage/8)

  • The low (least significant) bits of each byte represents the status of the slots that are earlier in the file.

  • note that all Java virtual machines are big-endian.

  • To further simplify your life, you may assume that SimpleDB will not crash while processing a transactionComplete command.

maven

./mvnw test -Dtest='Tuple*'
./mvnw exec:java -D"exec.mainClass"="simpledb.SimpleDb" -Dexec.args="convert file.txt N"

install dependencies

make install

Packages

No packages published

Languages

  • Java 99.7%
  • Other 0.3%