diff --git a/Cargo.lock b/Cargo.lock index 5ea4f8e48568..a400dc8f0fa6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -807,6 +807,7 @@ dependencies = [ "lazy_static", "log-store", "meta-client", + "mito", "object-store", "opendal", "regex", @@ -815,7 +816,6 @@ dependencies = [ "snafu", "storage", "table", - "table-engine", "tempdir", "tokio", ] @@ -1739,6 +1739,7 @@ dependencies = [ "meta-client", "meta-srv", "metrics", + "mito", "object-store", "query", "script", @@ -1751,7 +1752,6 @@ dependencies = [ "store-api", "substrait 0.1.0", "table", - "table-engine", "tempdir", "tokio", "tokio-stream", @@ -3187,6 +3187,36 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "mito" +version = "0.1.0" +dependencies = [ + "arc-swap", + "async-stream", + "async-trait", + "chrono", + "common-catalog", + "common-error", + "common-query", + "common-recordbatch", + "common-telemetry", + "common-time", + "datafusion", + "datafusion-common", + "datatypes", + "futures", + "log-store", + "object-store", + "serde", + "serde_json", + "snafu", + "storage", + "store-api", + "table", + "tempdir", + "tokio", +] + [[package]] name = "moka" version = "0.9.6" @@ -5092,6 +5122,7 @@ dependencies = [ "futures", "futures-util", "log-store", + "mito", "paste", "query", "ron", @@ -5106,7 +5137,6 @@ dependencies = [ "sql", "storage", "table", - "table-engine", "tempdir", "tokio", "tokio-test", @@ -5469,10 +5499,10 @@ dependencies = [ "common-time", "datatypes", "itertools", + "mito", "once_cell", "snafu", "sqlparser", - "table-engine", ] [[package]] @@ -5778,36 +5808,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "table-engine" -version = "0.1.0" -dependencies = [ - "arc-swap", - "async-stream", - "async-trait", - "chrono", - "common-catalog", - "common-error", - "common-query", - "common-recordbatch", - "common-telemetry", - "common-time", - "datafusion", - "datafusion-common", - "datatypes", - "futures", - "log-store", - "object-store", - "serde", - "serde_json", - "snafu", - "storage", - "store-api", - "table", - "tempdir", - "tokio", -] - [[package]] name = "tagptr" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index ad51afb7078f..be37ca379055 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ members = [ "src/storage", "src/store-api", "src/table", - "src/table-engine", + "src/mito", ] [profile.release] diff --git a/src/catalog/Cargo.toml b/src/catalog/Cargo.toml index aa9f38f774d9..b4b88d966e8e 100644 --- a/src/catalog/Cargo.toml +++ b/src/catalog/Cargo.toml @@ -42,6 +42,6 @@ log-store = { path = "../log-store" } object-store = { path = "../object-store" } opendal = "0.17" storage = { path = "../storage" } -table-engine = { path = "../table-engine" } +mito = { path = "../mito" } tempdir = "0.3" tokio = { version = "1.0", features = ["full"] } diff --git a/src/catalog/src/system.rs b/src/catalog/src/system.rs index 887c4a8022d4..09980b7482ce 100644 --- a/src/catalog/src/system.rs +++ b/src/catalog/src/system.rs @@ -372,13 +372,13 @@ pub struct TableEntryValue { #[cfg(test)] mod tests { use log_store::fs::noop::NoopLogStore; + use mito::config::EngineConfig; + use mito::engine::MitoEngine; use object_store::ObjectStore; use storage::config::EngineConfig as StorageEngineConfig; use storage::EngineImpl; use table::metadata::TableType; use table::metadata::TableType::Base; - use table_engine::config::EngineConfig; - use table_engine::engine::MitoEngine; use tempdir::TempDir; use super::*; diff --git a/src/datanode/Cargo.toml b/src/datanode/Cargo.toml index c722c328d761..4b95e2a18bd5 100644 --- a/src/datanode/Cargo.toml +++ b/src/datanode/Cargo.toml @@ -46,7 +46,7 @@ storage = { path = "../storage" } store-api = { path = "../store-api" } substrait = { path = "../common/substrait" } table = { path = "../table" } -table-engine = { path = "../table-engine", features = ["test"] } +mito = { path = "../mito", features = ["test"] } tokio = { version = "1.18", features = ["full"] } tokio-stream = { version = "0.1", features = ["net"] } tonic = "0.8" diff --git a/src/datanode/src/instance.rs b/src/datanode/src/instance.rs index 9cf336b446d4..51ccf7068357 100644 --- a/src/datanode/src/instance.rs +++ b/src/datanode/src/instance.rs @@ -25,6 +25,8 @@ use log_store::fs::config::LogConfig; use log_store::fs::log::LocalFileLogStore; use meta_client::client::{MetaClient, MetaClientBuilder}; use meta_client::MetaClientOpts; +use mito::config::EngineConfig as TableEngineConfig; +use mito::engine::MitoEngine; use object_store::layers::LoggingLayer; use object_store::services::fs::Builder; use object_store::{util, ObjectStore}; @@ -33,8 +35,6 @@ use snafu::prelude::*; use storage::config::EngineConfig as StorageEngineConfig; use storage::EngineImpl; use table::table::TableIdProviderRef; -use table_engine::config::EngineConfig as TableEngineConfig; -use table_engine::engine::MitoEngine; use crate::datanode::{DatanodeOptions, ObjectStoreConfig}; use crate::error::{ diff --git a/src/datanode/src/mock.rs b/src/datanode/src/mock.rs index edbfe09c870e..240b68e04dec 100644 --- a/src/datanode/src/mock.rs +++ b/src/datanode/src/mock.rs @@ -19,12 +19,12 @@ use catalog::remote::MetaKvBackend; use common_catalog::consts::MIN_USER_TABLE_ID; use meta_client::client::{MetaClient, MetaClientBuilder}; use meta_srv::mocks::MockInfo; +use mito::config::EngineConfig as TableEngineConfig; use query::QueryEngineFactory; use storage::config::EngineConfig as StorageEngineConfig; use storage::EngineImpl; use table::metadata::TableId; use table::table::{TableIdProvider, TableIdProviderRef}; -use table_engine::config::EngineConfig as TableEngineConfig; use crate::datanode::DatanodeOptions; use crate::error::Result; @@ -38,7 +38,7 @@ impl Instance { // This method is used in other crate's testing codes, so move it out of "cfg(test)". // TODO(LFC): Delete it when callers no longer need it. pub async fn new_mock() -> Result { - use table_engine::table::test_util::{new_test_object_store, MockEngine, MockMitoEngine}; + use mito::table::test_util::{new_test_object_store, MockEngine, MockMitoEngine}; let mock_info = meta_srv::mocks::mock_with_memstore().await; let meta_client = Some(Arc::new(mock_meta_client(mock_info, 0).await)); diff --git a/src/datanode/src/sql.rs b/src/datanode/src/sql.rs index 01b3247c7e5c..2c928946bf8f 100644 --- a/src/datanode/src/sql.rs +++ b/src/datanode/src/sql.rs @@ -97,6 +97,8 @@ mod tests { use datatypes::schema::{ColumnSchema, SchemaBuilder, SchemaRef}; use datatypes::value::Value; use log_store::fs::noop::NoopLogStore; + use mito::config::EngineConfig as TableEngineConfig; + use mito::engine::MitoEngine; use object_store::services::fs::Builder; use object_store::ObjectStore; use query::QueryEngineFactory; @@ -106,8 +108,6 @@ mod tests { use table::error::Result as TableResult; use table::metadata::TableInfoRef; use table::{Table, TableRef}; - use table_engine::config::EngineConfig as TableEngineConfig; - use table_engine::engine::MitoEngine; use tempdir::TempDir; use super::*; diff --git a/src/datanode/src/tests/test_util.rs b/src/datanode/src/tests/test_util.rs index 497167c30256..eeb7eaf30a38 100644 --- a/src/datanode/src/tests/test_util.rs +++ b/src/datanode/src/tests/test_util.rs @@ -20,11 +20,11 @@ use common_catalog::consts::{DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME, MIN_USER use datatypes::data_type::ConcreteDataType; use datatypes::schema::{ColumnSchema, SchemaBuilder}; use frontend::frontend::Mode; +use mito::config::EngineConfig; +use mito::table::test_util::{new_test_object_store, MockEngine, MockMitoEngine}; use snafu::ResultExt; use table::engine::{EngineContext, TableEngineRef}; use table::requests::CreateTableRequest; -use table_engine::config::EngineConfig; -use table_engine::table::test_util::{new_test_object_store, MockEngine, MockMitoEngine}; use tempdir::TempDir; use crate::datanode::{DatanodeOptions, ObjectStoreConfig}; diff --git a/src/table-engine/Cargo.toml b/src/mito/Cargo.toml similarity index 98% rename from src/table-engine/Cargo.toml rename to src/mito/Cargo.toml index 3a81c782bde9..63612075f77d 100644 --- a/src/table-engine/Cargo.toml +++ b/src/mito/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "table-engine" +name = "mito" version = "0.1.0" edition = "2021" license = "Apache-2.0" diff --git a/src/mito/README.md b/src/mito/README.md new file mode 100644 index 000000000000..facfbfa5d633 --- /dev/null +++ b/src/mito/README.md @@ -0,0 +1,8 @@ +# Mito + +Mito is GreptimeDB's default table engine. + +## About Mito +The Alfa Romeo [MiTo](https://en.wikipedia.org/wiki/Alfa_Romeo_MiTo) is a front-wheel drive, three-door supermini designed by Centro Stile Alfa Romeo. + +> "You can't be a true petrolhead until you've owned an Alfa Romeo." -- by Jeremy Clarkson diff --git a/src/table-engine/src/config.rs b/src/mito/src/config.rs similarity index 100% rename from src/table-engine/src/config.rs rename to src/mito/src/config.rs diff --git a/src/table-engine/src/engine.rs b/src/mito/src/engine.rs similarity index 99% rename from src/table-engine/src/engine.rs rename to src/mito/src/engine.rs index 29e2f09c74d3..8154ad2ecd9c 100644 --- a/src/table-engine/src/engine.rs +++ b/src/mito/src/engine.rs @@ -64,7 +64,7 @@ fn table_dir(schema_name: &str, table_name: &str) -> String { /// [TableEngine] implementation. /// /// About mito . -/// "you can't be a true petrolhead until you've owned an Alfa Romeo" -- by Jeremy Clarkson +/// "You can't be a true petrolhead until you've owned an Alfa Romeo." -- by Jeremy Clarkson #[derive(Clone)] pub struct MitoEngine { inner: Arc>, diff --git a/src/table-engine/src/error.rs b/src/mito/src/error.rs similarity index 100% rename from src/table-engine/src/error.rs rename to src/mito/src/error.rs diff --git a/src/table-engine/src/lib.rs b/src/mito/src/lib.rs similarity index 100% rename from src/table-engine/src/lib.rs rename to src/mito/src/lib.rs diff --git a/src/table-engine/src/manifest.rs b/src/mito/src/manifest.rs similarity index 100% rename from src/table-engine/src/manifest.rs rename to src/mito/src/manifest.rs diff --git a/src/table-engine/src/manifest/action.rs b/src/mito/src/manifest/action.rs similarity index 100% rename from src/table-engine/src/manifest/action.rs rename to src/mito/src/manifest/action.rs diff --git a/src/table-engine/src/table.rs b/src/mito/src/table.rs similarity index 100% rename from src/table-engine/src/table.rs rename to src/mito/src/table.rs diff --git a/src/table-engine/src/table/test_util.rs b/src/mito/src/table/test_util.rs similarity index 100% rename from src/table-engine/src/table/test_util.rs rename to src/mito/src/table/test_util.rs diff --git a/src/table-engine/src/table/test_util/mock_engine.rs b/src/mito/src/table/test_util/mock_engine.rs similarity index 100% rename from src/table-engine/src/table/test_util/mock_engine.rs rename to src/mito/src/table/test_util/mock_engine.rs diff --git a/src/script/Cargo.toml b/src/script/Cargo.toml index b894736c3d23..cde4f8391c7f 100644 --- a/src/script/Cargo.toml +++ b/src/script/Cargo.toml @@ -58,7 +58,7 @@ log-store = { path = "../log-store" } ron = "0.7" serde = { version = "1.0", features = ["derive"] } storage = { path = "../storage" } -table-engine = { path = "../table-engine", features = ["test"] } +mito = { path = "../mito", features = ["test"] } tempdir = "0.3" tokio = { version = "1.18", features = ["full"] } tokio-test = "0.4" diff --git a/src/script/src/manager.rs b/src/script/src/manager.rs index be9825587056..1949c7723359 100644 --- a/src/script/src/manager.rs +++ b/src/script/src/manager.rs @@ -96,17 +96,17 @@ impl ScriptManager { #[cfg(test)] mod tests { use catalog::CatalogManager; + use mito::config::EngineConfig as TableEngineConfig; + use mito::table::test_util::new_test_object_store; use query::QueryEngineFactory; - use table_engine::config::EngineConfig as TableEngineConfig; - use table_engine::table::test_util::new_test_object_store; use super::*; type DefaultEngine = MitoEngine>; use log_store::fs::config::LogConfig; use log_store::fs::log::LocalFileLogStore; + use mito::engine::MitoEngine; use storage::config::EngineConfig as StorageEngineConfig; use storage::EngineImpl; - use table_engine::engine::MitoEngine; use tempdir::TempDir; #[tokio::test] diff --git a/src/sql/Cargo.toml b/src/sql/Cargo.toml index 457bb988771a..7b3949e04300 100644 --- a/src/sql/Cargo.toml +++ b/src/sql/Cargo.toml @@ -15,4 +15,4 @@ itertools = "0.10" once_cell = "1.10" snafu = { version = "0.7", features = ["backtraces"] } sqlparser = "0.15.0" -table-engine = { path = "../table-engine" } +mito = { path = "../mito" } diff --git a/src/sql/src/parsers/create_parser.rs b/src/sql/src/parsers/create_parser.rs index af52f12603c3..d1a76ffacfd9 100644 --- a/src/sql/src/parsers/create_parser.rs +++ b/src/sql/src/parsers/create_parser.rs @@ -15,13 +15,13 @@ use std::cmp::Ordering; use itertools::Itertools; +use mito::engine; use once_cell::sync::Lazy; use snafu::{ensure, OptionExt, ResultExt}; use sqlparser::ast::Value; use sqlparser::dialect::keywords::Keyword; use sqlparser::parser::IsOptional::Mandatory; use sqlparser::tokenizer::{Token, Word}; -use table_engine::engine; use crate::ast::{ColumnDef, Ident, TableConstraint, Value as SqlValue}; use crate::error::{self, InvalidTimeIndexSnafu, Result, SyntaxSnafu};