GithubHelp home page GithubHelp logo

haoming-yu / minisql Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 8.04 MB

my engine of database, created by changing the CMU bustub frame work

License: MIT License

CMake 0.77% Shell 0.04% C++ 69.23% C 27.35% Lex 0.81% Yacc 1.80%

minisql's Introduction

MiniSQL

本框架参考CMU-15445 BusTub框架进行改写,在保留了缓冲池、索引、记录模块的一些核心设计理念的基础上,做了一些修改和扩展,使之兼容于原MiniSQL实验指导的要求。 以下列出了改动/扩展较大的几个地方:

  • 对Disk Manager模块进行改动,扩展了位图页、磁盘文件元数据页用于支持持久化数据页分配回收状态;
  • 在Record Manager, Index Manager, Catalog Manager等模块中,通过对内存对象的序列化和反序列化来持久化数据;
  • 对Record Manager层的一些数据结构(RowFieldSchemaColumn等)和实现进行重构;
  • 对Catalog Manager层进行重构,支持持久化并为Executor层提供接口调用;
  • 扩展了Parser层,Parser层支持输出语法树供Executor层调用;

此外还涉及到很多零碎的改动,包括源代码中部分模块代码的调整,测试代码的修改,性能上的优化等,在此不做赘述。

注意:为了避免代码抄袭,请不要将自己的代码发布到任何公共平台中。

编译&开发环境

  • Apple clang version: 11.0+ (MacOS),使用gcc --versiong++ --version查看
  • gcc & g++ : 8.0+ (Linux),使用gcc --versiong++ --version查看
  • cmake: 3.20+ (Both),使用cmake --version查看
  • gdb: 7.0+ (Optional),使用gdb --version查看
  • flex & bison (暂时不需要安装,但如果需要对SQL编译器的语法进行修改,需要安装)
  • llvm-symbolizer (暂时不需要安装)

构建

Windows

目前该代码暂不支持在Windows平台上的编译。但在Win10及以上的系统中,可以通过安装WSL(Windows的Linux子系统)来进行 开发和构建。WSL请选择Ubuntu子系统(推荐Ubuntu20及以上)。如果你使用Clion作为IDE,可以在Clion中配置WSL从而进行调试,具体请参考 Clion with WSL

MacOS & Linux & WSL

基本构建命令

mkdir build
cd build
cmake ..
make -j

若不涉及到CMakeLists相关文件的变动且没有新增或删除.cpp代码(通俗来说,就是只是对现有代码做了修改) 则无需重新执行cmake..命令,直接执行make -j编译即可。

默认以debug模式进行编译,如果你需要使用release模式进行编译:

cmake -DCMAKE_BUILD_TYPE=Release ..

测试

在构建后,默认会在build/test目录下生成minisql_test的可执行文件,通过./minisql_test即可运行所有测试。

如果需要运行单个测试,例如,想要运行lru_replacer_test.cpp对应的测试文件,可以通过make lru_replacer_test 命令进行构建。

完成心得

由于写入磁盘需要时间,源框架中设计了sleep(1)来保留这个时间,防止select的时候命令行显示不全的情况出现,最后测试的时候为了加速将此指令取消。如果后续仍然需要确保select结果完整正确,可以通过对执行调用select指令的上层函数单独添加sleep指令来保证结果的完整正确

minisql's People

Contributors

haoming-yu avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

albertc-2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.