BusTub is a relational database management system built at Carnegie Mellon University for the Introduction to Database Systems (15-445/645) course. This system was developed for educational purposes and should not be used in production environments.
The following instructions will create a private BusTub that you can use for your development:
- Go to https://github.com/new to create a new repo under your account. Pick a name (e.g.
private-bustub
) and make sure it is you select it as private. - On your development machine, clone the public BusTub:
$ git clone --depth 1 https://github.com/cmu-db/bustub.git public-bustub
- You next need to mirror the public BusTub repo into your own private BusTub repo. Suppose your GitHub name is
student
and your repo name isprivate-bustub
, you will execute the following commands:This copies everything in the public BusTub repo into your own private repo. You can now delete this bustub directory:$ cd public-bustub $ git push --mirror git@github.com:student/private-bustub.git
$ cd .. $ rm -rv public-bustub
- Clone your own private repo on:
$ git clone git@github.com:student/private-bustub.git
- Add the public BusTub as a remote source. This will allow you to retrieve changes from the CMU-DB repository during the semester:
$ git remote add public https://github.com/cmu-db/bustub.git
- You can now pull in changes from the public BusTub as needed:
$ git pull public master
We suggest working on your projects in separate branches. If you do not understand how Git branches work, learn how. If you fail to do this, you might lose all your work at some point in the semester, and nobody will be able to help you.
To ensure that you have the proper packages on your machine, run the following script to automatically install them:
$ sudo build_support/packages.sh
Then run the following commands to build the system:
$ mkdir build
$ cd build
$ cmake ..
$ make
If you want to compile the system in debug mode, pass in the following flag to cmake: Debug mode:
$ cmake -DCMAKE_BUILD_TYPE=Debug ..
$ make
This enables AddressSanitizer, which can generate false positives for overflow on STL containers. If you encounter this, define the environment variable ASAN_OPTIONS=detect_container_overflow=0
.
If you are using Windows 10, you can use the Windows Subsystem for Linux (WSL) to develop, build, and test Bustub. All you need is to Install WSL. You can just choose "Ubuntu" (no specific version) in Microsoft Store. Then, enter WSL and follow the above instructions.
If you are using CLion, it also works with WSL.
$ cd build
$ make check-tests
If you have trouble getting cmake or make to run, an easy solution is to create a virtual container to build in. There are two options available:
First, make sure you have Vagrant and Virtualbox installed
$ sudo apt update
$ sudo apt install vagrant virtualbox
From the repository directory, run this command to create and start a Vagrant box:
$ vagrant up
This will start a Vagrant box running Ubuntu 20.02 in the background with all the packages needed. To access it, type
$ vagrant ssh
to open a shell within the box. You can find Bustub's code mounted at /bustub
and run the commands mentioned above like normal.
First, make sure that you have docker installed:
$ sudo apt update
$ sudo apt install docker
From the repository directory, run these commands to create a Docker image and container:
$ docker build . -t bustub
$ docker create -t -i --name bustub -v $(pwd):/bustub bustub bash
This will create a Docker image and container. To run it, type:
$ docker start -a -i bustub
to open a shell within the box. You can find Bustub's code mounted at /bustub
and run the commands mentioned above like normal.