isomorphicdb
isomorphicdb copied to clipboard
The core repository of implementing PostgreSQL compatible distributed database in Rust
IsomorphicDB
TODO List
- [ ] PostgreSQL compatibility
- [ ] PostgreSQL wire protocol
- [ ] Data types
- [ ] Data definition language
- [ ] Create/Drop/Alter table
- [ ] Create/Drop index
- [ ] Primary/Foreign keys
- [ ] Check constraints
- [ ] Data manipulation language
- [ ] Transactions
- [ ] Reactive Dataflow query execution
- [ ] With RSocket for inter node communication
- [ ] Query compilation
- [ ] HTAP (Hybrid transactional/analytical processing)
- [ ] Raft replication
- [ ] Operability
- [ ] Smooth version upgrade
- [ ] Ease of adding/removing node from the cluster (including quick replication)
- [ ] Self-driving
Play around with project
See docs
Project structure
docs/- project documentationetc/- scripts for convenient run of compatibility tests and other toolsci/- script helpers to run commands onGitHub Actionslocal/- scripts for local usage
gradle/- gradle wrapper to runtests/compatibilitytestsnode_engine/- module that glues all other together to handle incoming network request and execute it across other modulespostgres/- crate to consolidate PostgreSQL functionalityquery_ast/- abstract syntax tree of parsed SQL queryquery_parser/- parser that produce AST from SQL stringquery_response/- module to represent successful or error response after query execution to a client
sql_engine/- crate to consolidate SQL query engine functionalitycatalog/- API for accessing data and its definitiondata_definition/- group of modules responsible to representSQL DDLqueriesexecution_plan- data structures responsible for representing operations ofData Definition Languagepart ofSQL
data_manipulation/- group of modules responsible to representSQL DMLqueriesoperators/- SQL operators like+,-,LIKE,AND,ORand othersquery_plan/- query plan that is executed over database dataquery_result/- internal representation of query execution resulttyped_queries/- represents query structure that is ready for type coercion and type checktyped_tree/- typed binary tree of SQL operatorsuntyped_queries/- represents query structure that is ready for type resolutionuntyped_tree/- untyped binary tree of SQL operators
definition_planner/- API to create execution plan for a DDL queryentities/- database entitiesdefinition/- database object names and its definitionstypes/- SQL types
query_analyzer/- API to analyse a parsed SQL queryquery_planner/- API to create execution plan for a SQL queryquery_processing/- API to process a parsed/analyzed SQL querytype_check/type_coercion/type_inference/
scalar/- representing primitive types as a scalar value that can be use as intermediate computational result
storage/- database transactional storageapi/- type aliases and traits that defines api forin_memoryandpersistentstoragebinary/- representing primitive types as a raw binary vectorin_memory/- in memory only storagepersistent/- persistent storage
tests/compatibility/- groovy based tests to check compatibility with PostgreSQLerlang_client/- erlang based testsfixtures/- files needed to set up non-default local testing
Development
Build time dependencies
isomorphicdb uses postgres-parser to parse PostgreSQL 13 SQL syntax which
requires LLVM. Thus, to build project you need to install LLVM and add it to $PATH
On Ubuntu the following command should be sufficient:
sudo apt install llvm
On MacOS with zsh
brew install llvm
echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' ~/.zshrc
source ~/.zshrc
Setting up integration suite for local testing
For now, it is local and manual - that means some software has to be installed on a local machine and queries result has to be checked visually.
- Install
psql(PostgreSQL client)- Often it comes with
PostgreSQLbinaries. On macOS, you can install it withbrewexecuting the following command:
brew install postgresql - Often it comes with
- Start the
isomorphicdbinstance with the command:cargo run - Start
psqlwith the following command:psql -h 127.0.0.1 -W- enter any password
- Run
sqlscripts fromcompatibilityfolder
Compute code coverage locally
- Run
./etc/local/code_coverage.sh - Open
./target/debug/coverage/index.htmlin your browser
Running Compatibility tests locally
- Install
javaversion8or11(that were tested) - (Optional) Install
gradleversion6(that were tested) - Run
RUST_LOG=debug cargo runfrom project folder in separate terminal window - Run
./etc/local/compatibility.sh