jercheng / zpd

A simple SQL-like database built on top of Key-Value storages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ZPD

Build Status Coverage Status version version version

Overview

ZPD (or ZaloPay Database) is a probationary challenge performed at ZaloPay. It's an experiment to gain deep knowledge about handling simple SQL queries and how to glue them with a key-value storage.

ZPD is implemented using Golang as a gRPC service and built on top of following frameworks:

  • Consul for leader elections.

  • TiKV as the main key-value storage

Architecture

The architecture of the ZPD:

Including layers:

  • Connection layer
  • Parser layer
  • Core layer:
    • Executor
    • Consul Agent
    • Bridge API
  • Data access layer
  • Storage:
    • TiKV client layer

See the architecture of ZPD here.

Requirement

  • Golang version >= 1.12
  • gRPC
  • Docker version >= 17.06 and Docker Compose
  • Locust

Install

Build

Clone this project:

# Clone
$ git clone https://gitlab.zalopay.vn/zpx-core-team/tidb-internals.git

Run

ZPD, PD, TiKV, Consul are all built with Docker compose. Just go to the docker-compose folder and run docker-compose up.

# go to the folder docker-compose
$ cd ./tidb-layer/source/docker-compose

# Run docker-compose
$ docker-compose up

Test

Must run ZPD as the section above, then run tests of the APIs:

# go to cmd/client
$ cd ./tidb-layer/source/cmd/client

# run tests
$ go test -run TestClientExecuteCreateDB 
  • You can write more tests into client_test.go like the available format.

Document

Read more document about ZPD:

Read blogs:

Contribution

This project was built by AJPham and Alex Nguyen under the guidance from Anh Le (Andy).

Acknowledgments

License

See the LICENSE file for license rights and limitations.

About

A simple SQL-like database built on top of Key-Value storages

License:Apache License 2.0


Languages

Language:Go 62.8%Language:Python 31.6%Language:Shell 2.9%Language:Dockerfile 2.1%Language:Smarty 0.7%