feat: use raft-engine crate to reimplement logstore (#799)

(cherry picked from commit 8f5ecefc90)
This commit is contained in:
Lei, HUANG
2023-01-05 17:18:51 +08:00
parent bc9a46dbb7
commit 53ee85cdad
43 changed files with 1203 additions and 3056 deletions

View File

@@ -23,7 +23,7 @@ python = [
]
[dependencies]
async-trait = "0.1"
async-trait.workspace = true
catalog = { path = "../catalog" }
common-catalog = { path = "../common/catalog" }
common-error = { path = "../common/error" }
@@ -33,26 +33,28 @@ common-recordbatch = { path = "../common/recordbatch" }
common-telemetry = { path = "../common/telemetry" }
common-time = { path = "../common/time" }
console = "0.15"
crossbeam-utils = "0.8.14"
datafusion = { workspace = true, optional = true }
datafusion-common = { workspace = true, optional = true }
datafusion-expr = { workspace = true, optional = true }
datafusion-physical-expr = { workspace = true, optional = true }
datatypes = { path = "../datatypes" }
futures = "0.3"
futures-util = "0.3"
paste = { version = "1.0", optional = true }
futures.workspace = true
once_cell = "1.17.0"
paste = { workspace = true, optional = true }
query = { path = "../query" }
# TODO(discord9): This is a forked and tweaked version of RustPython, please update it to newest original RustPython After Update toolchain to 1.65
rustpython-ast = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab" }
rustpython-codegen = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab" }
rustpython-compiler = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab" }
rustpython-compiler-core = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab" }
rustpython-parser = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab" }
rustpython-pylib = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab", features = [
rustpython-ast = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537" }
rustpython-codegen = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537" }
rustpython-compiler = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537" }
rustpython-compiler-core = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537" }
rustpython-parser = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537" }
rustpython-pylib = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537", features = [
"freeze-stdlib",
] }
rustpython-stdlib = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab" }
rustpython-vm = { git = "https://github.com/discord9/RustPython", optional = true, rev = "183e8dab", features = [
rustpython-stdlib = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537" }
rustpython-vm = { git = "https://github.com/discord9/RustPython", optional = true, rev = "f89b1537", features = [
"default",
"codegen",
] }
@@ -68,6 +70,7 @@ mito = { path = "../mito", features = ["test"] }
ron = "0.7"
serde = { version = "1.0", features = ["derive"] }
storage = { path = "../storage" }
store-api = { path = "../store-api" }
tempdir = "0.3"
tokio = { version = "1.18", features = ["full"] }
tokio-test = "0.4"

View File

@@ -101,12 +101,15 @@ mod tests {
use query::QueryEngineFactory;
use super::*;
type DefaultEngine = MitoEngine<EngineImpl<LocalFileLogStore>>;
use log_store::fs::config::LogConfig;
use log_store::fs::log::LocalFileLogStore;
type DefaultEngine = MitoEngine<EngineImpl<RaftEngineLogStore>>;
use log_store::raft_engine::log_store::RaftEngineLogStore;
use log_store::LogConfig;
use mito::engine::MitoEngine;
use storage::config::EngineConfig as StorageEngineConfig;
use storage::EngineImpl;
use store_api::logstore::LogStore;
use tempdir::TempDir;
#[tokio::test]
@@ -121,7 +124,8 @@ mod tests {
..Default::default()
};
let log_store = LocalFileLogStore::open(&log_config).await.unwrap();
let log_store = RaftEngineLogStore::try_new(log_config).unwrap();
log_store.start().await.unwrap();
let mock_engine = Arc::new(DefaultEngine::new(
TableEngineConfig::default(),