Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(storages): merge storages/constants to storages/table-meta #8648

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ members = [
"src/query/settings",
"src/query/sql",
"src/query/storages/cache",
"src/query/storages/constants",
"src/query/storages/factory",
"src/query/storages/fuse/fuse",
"src/query/storages/fuse/fuse-result",
Expand Down
1 change: 0 additions & 1 deletion src/query/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ common-settings = { path = "../settings" }
common-sql = { path = "../sql" }
common-storage = { path = "../../common/storage" }
common-storages-cache = { path = "../storages/cache" }
common-storages-constants = { path = "../storages/constants" }
common-storages-factory = { path = "../storages/factory" }
common-storages-fuse = { path = "../storages/fuse/fuse" }
common-storages-fuse-result = { path = "../storages/fuse/fuse-result" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ use common_datavalues::prelude::*;
use common_exception::Result;
use common_planner::plans::ShowCreateTablePlan;
use common_sql::executor::PhysicalScalar;
use common_storages_table_meta::table::is_internal_opt_key;
use tracing::debug;

use crate::interpreters::Interpreter;
use crate::pipelines::PipelineBuildResult;
use crate::sessions::QueryContext;
use crate::sessions::TableContext;
use crate::sql::is_internal_opt_key;

pub struct ShowCreateTableInterpreter {
ctx: Arc<QueryContext>,
Expand Down
4 changes: 2 additions & 2 deletions src/query/service/tests/it/storages/fuse/pruning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ use common_sql::executor::ExpressionOp;
use common_storages_fuse::FuseTable;
use common_storages_table_meta::meta::BlockMeta;
use common_storages_table_meta::meta::TableSnapshot;
use common_storages_table_meta::table::OPT_KEY_DATABASE_ID;
use common_storages_table_meta::table::OPT_KEY_SNAPSHOT_LOCATION;
use databend_query::interpreters::CreateTableInterpreterV2;
use databend_query::interpreters::Interpreter;
use databend_query::sessions::QueryContext;
use databend_query::sessions::TableContext;
use databend_query::sql::plans::create_table_v2::CreateTablePlanV2;
use databend_query::sql::OPT_KEY_DATABASE_ID;
use databend_query::sql::OPT_KEY_SNAPSHOT_LOCATION;
use databend_query::storages::fuse::io::MetaReaders;
use databend_query::storages::fuse::pruning::BlockPruner;
use databend_query::storages::fuse::FUSE_OPT_KEY_BLOCK_PER_SEGMENT;
Expand Down
4 changes: 2 additions & 2 deletions src/query/service/tests/it/storages/fuse/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ use common_planner::plans::DropTableClusterKeyPlan;
use common_planner::ReadDataSourcePlan;
use common_planner::SourceInfo;
use common_sql::executor::table_read_plan::ToReadDataSourcePlan;
use common_storages_table_meta::table::OPT_KEY_DATABASE_ID;
use common_storages_table_meta::table::OPT_KEY_SNAPSHOT_LOCATION;
use databend_query::interpreters::AlterTableClusterKeyInterpreter;
use databend_query::interpreters::CreateTableInterpreterV2;
use databend_query::interpreters::DropTableClusterKeyInterpreter;
Expand All @@ -31,8 +33,6 @@ use databend_query::interpreters::InterpreterFactory;
use databend_query::sessions::TableContext;
use databend_query::sql::plans::create_table_v2::CreateTablePlanV2;
use databend_query::sql::Planner;
use databend_query::sql::OPT_KEY_DATABASE_ID;
use databend_query::sql::OPT_KEY_SNAPSHOT_LOCATION;
use databend_query::storages::fuse::io::MetaReaders;
use databend_query::storages::fuse::FuseTable;
use databend_query::stream::DataBlockStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use common_sql::executor::table_read_plan::ToReadDataSourcePlan;
use common_storage::StorageFsConfig;
use common_storage::StorageParams;
use common_storages_fuse::FUSE_TBL_XOR_BLOOM_INDEX_PREFIX;
use common_storages_table_meta::table::OPT_KEY_DATABASE_ID;
use common_streams::SendableDataBlockStream;
use databend_query::interpreters::append2table;
use databend_query::interpreters::CreateTableInterpreterV2;
Expand All @@ -41,7 +42,6 @@ use databend_query::sessions::QueryContext;
use databend_query::sessions::TableContext;
use databend_query::sql::plans::create_table_v2::CreateTablePlanV2;
use databend_query::sql::Planner;
use databend_query::sql::OPT_KEY_DATABASE_ID;
use databend_query::storages::fuse::table_functions::ClusteringInformationTable;
use databend_query::storages::fuse::table_functions::FuseSnapshotTable;
use databend_query::storages::fuse::FUSE_TBL_BLOCK_PREFIX;
Expand Down
1 change: 0 additions & 1 deletion src/query/sql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ common-pipeline-transforms = { path = "../pipeline/transforms" }
common-planner = { path = "../planner" }
common-settings = { path = "../settings" }
common-storage = { path = "../../common/storage" }
common-storages-constants = { path = "../storages/constants" }
common-storages-table-meta = { path = "../storages/table-meta" }
common-storages-view = { path = "../storages/view" }
common-tracing = { path = "../../common/tracing" }
Expand Down
1 change: 0 additions & 1 deletion src/query/sql/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ pub mod evaluator;
pub mod executor;
pub mod planner;

pub use common_storages_constants::*;
pub use planner::*;
4 changes: 2 additions & 2 deletions src/query/sql/src/planner/binder/ddl/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ use common_planner::plans::UndropTablePlan;
use common_storage::parse_uri_location;
use common_storage::DataOperator;
use common_storage::UriLocation;
use common_storages_constants::is_reserved_opt_key;
use common_storages_constants::OPT_KEY_DATABASE_ID;
use common_storages_table_meta::table::is_reserved_opt_key;
use common_storages_table_meta::table::OPT_KEY_DATABASE_ID;
use tracing::debug;

use crate::binder::scalar::ScalarBinder;
Expand Down
16 changes: 0 additions & 16 deletions src/query/storages/constants/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion src/query/storages/fuse/fuse/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ common-sharing = { path = "../../../sharing" }
common-sql = { path = "../../../../common/../query/sql" }
common-storage = { path = "../../../../common/storage" }
common-storages-cache = { path = "../../cache" }
common-storages-constants = { path = "../../constants" }
common-storages-index = { path = "../../index" }
common-storages-table-meta = { path = "../../table-meta" }

Expand Down
8 changes: 4 additions & 4 deletions src/query/storages/fuse/fuse/src/fuse_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ use common_storages_table_meta::meta::ColumnStatistics as FuseColumnStatistics;
use common_storages_table_meta::meta::Statistics as FuseStatistics;
use common_storages_table_meta::meta::TableSnapshot;
use common_storages_table_meta::meta::Versioned;
use common_storages_table_meta::table::table_storage_prefix;
use common_storages_table_meta::table::OPT_KEY_DATABASE_ID;
use common_storages_table_meta::table::OPT_KEY_LEGACY_SNAPSHOT_LOC;
use common_storages_table_meta::table::OPT_KEY_SNAPSHOT_LOCATION;
use opendal::Operator;
use uuid::Uuid;

Expand All @@ -55,7 +59,6 @@ use crate::io::MetaReaders;
use crate::io::TableMetaLocationGenerator;
use crate::operations::AppendOperationLogEntry;
use crate::pipelines::Pipeline;
use crate::table_storage_prefix;
use crate::NavigationPoint;
use crate::Table;
use crate::TableStatistics;
Expand All @@ -64,9 +67,6 @@ use crate::DEFAULT_ROW_PER_BLOCK;
use crate::FUSE_OPT_KEY_BLOCK_IN_MEM_SIZE_THRESHOLD;
use crate::FUSE_OPT_KEY_ROW_PER_BLOCK;
use crate::FUSE_TBL_LAST_SNAPSHOT_HINT;
use crate::OPT_KEY_DATABASE_ID;
use crate::OPT_KEY_LEGACY_SNAPSHOT_LOC;
use crate::OPT_KEY_SNAPSHOT_LOCATION;

#[derive(Clone)]
pub struct FuseTable {
Expand Down
1 change: 0 additions & 1 deletion src/query/storages/fuse/fuse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use common_catalog::table::Table;
use common_catalog::table::TableStatistics;
pub use common_catalog::table_context::TableContext;
use common_catalog::table_mutator::TableMutator;
pub use common_storages_constants::*;
pub use constants::*;
pub use fuse_part::ColumnLeaf;
pub use fuse_part::ColumnLeaves;
Expand Down
5 changes: 3 additions & 2 deletions src/query/storages/fuse/fuse/src/operations/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use common_storages_table_meta::meta::SegmentInfo;
use common_storages_table_meta::meta::Statistics;
use common_storages_table_meta::meta::TableSnapshot;
use common_storages_table_meta::meta::Versioned;
use common_storages_table_meta::table::OPT_KEY_SNAPSHOT_LOCATION;
use opendal::Operator;
use tracing::debug;
use tracing::info;
Expand All @@ -59,8 +60,6 @@ use crate::operations::TableOperationLog;
use crate::statistics;
use crate::statistics::merge_statistics;
use crate::FuseTable;
use crate::OPT_KEY_LEGACY_SNAPSHOT_LOC;
use crate::OPT_KEY_SNAPSHOT_LOCATION;

const OCC_DEFAULT_BACKOFF_INIT_DELAY_MS: Duration = Duration::from_millis(5);
const OCC_DEFAULT_BACKOFF_MAX_DELAY_MS: Duration = Duration::from_millis(20 * 1000);
Expand Down Expand Up @@ -579,6 +578,8 @@ impl MutatorConflictDetector {
mod utils {
use std::collections::BTreeMap;

use common_storages_table_meta::table::OPT_KEY_LEGACY_SNAPSHOT_LOC;

use super::*;
use crate::metrics::metrics_inc_commit_mutation_aborts;

Expand Down
2 changes: 1 addition & 1 deletion src/query/storages/fuse/fuse/src/operations/navigate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ use common_exception::ErrorCode;
use common_exception::Result;
use common_meta_app::schema::TableStatistics;
use common_storages_table_meta::meta::TableSnapshot;
use common_storages_table_meta::table::OPT_KEY_SNAPSHOT_LOCATION;
use futures::TryStreamExt;

use crate::io::MetaReaders;
use crate::io::SnapshotHistoryReader;
use crate::FuseTable;
use crate::OPT_KEY_SNAPSHOT_LOCATION;

impl FuseTable {
pub async fn navigate_to_time_point(
Expand Down
2 changes: 1 addition & 1 deletion src/query/storages/fuse/fuse/src/operations/truncate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use common_meta_app::schema::UpdateTableMetaReq;
use common_meta_types::MatchSeq;
use common_storages_table_meta::meta::TableSnapshot;
use common_storages_table_meta::meta::Versioned;
use common_storages_table_meta::table::OPT_KEY_SNAPSHOT_LOCATION;
use uuid::Uuid;

use crate::FuseTable;
use crate::OPT_KEY_SNAPSHOT_LOCATION;

impl FuseTable {
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion src/query/storages/share/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test = false
common-exception = { path = "../../../common/exception" }
common-meta-app = { path = "../../../meta/app" }
common-storages-cache = { path = "../cache" }
common-storages-constants = { path = "../constants" }
common-storages-table-meta = { path = "../table-meta" }

opendal = { version = "0.19", features = ["layers-retry"] }
serde = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions src/query/storages/share/src/share.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ pub async fn save_share_spec(
}

mod ext {
use common_storages_constants::database_storage_prefix;
use common_storages_constants::table_storage_prefix;
use common_storages_table_meta::table::database_storage_prefix;
use common_storages_table_meta::table::table_storage_prefix;

use super::*;

Expand Down
1 change: 1 addition & 0 deletions src/query/storages/table-meta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@

pub mod caches;
pub mod meta;
pub mod table;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Datafuse Labs.
// Copyright 2021 Datafuse Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -12,10 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![deny(unused_crate_dependencies)]
mod table_keys;
mod table_prefix;

mod table_option_keys;
mod table_storage_prefix;

pub use table_option_keys::*;
pub use table_storage_prefix::*;
pub use table_keys::*;
pub use table_prefix::*;