Code Monkey home page Code Monkey logo

kangaroo's Introduction

Kangaroo

img

From mit-6.830 用go实现的一个关系数据库

支持的一些功能

  • JOIN
  • PROJECTION
  • ORDER BY
  • LIMIT
  • GROUP BY
    • having

Installation 安装

> git clone https://github.com/Haibarapink/Kangaroo.git 
> cd Kangaroo
> go build main
> ./main

Architecture 架构

img

Implementation 实现

Operator 算子

  • JOIN nested-join 算法
  • ORDER BY 一次取出所有的Tuple, 然后按照列的顺序排序
  • GROUP BY 按照列来生成map,map的key是对应的group by的列的key,然后将相同的key的tuple保存在同一个数组里 ,最后根据聚合函数来分组返回

Transaction 事务

  • Force/NoSteal机制,假设事务Commit写入磁盘不会失败。

Force Commit的时候必须将脏数据写入磁盘中。

NoSteal 脏数据不允许写入磁盘,BufferPool做页置换的时候,不将脏页淘汰即可。

  • 死锁处理:DeadLock detection

如果事务持有pageA, 其他事务请求pageA失败,此时可以看作请求pageA事务有一条指向持有pageA事务的边。 依照这样的抽象,可以构成一个图,开启一个线程,每100ms检测图中是否存在环,如果存在,返回一个节点(事务ID), 将事务Abort掉。

Examples

img

img

img

kangaroo's People

Contributors

haibarapink avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

antonioxv

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.