Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/risingwavelabs/risingwave i…
Browse files Browse the repository at this point in the history
…nto li0k/storage_fix_sb_compact_sst_size
  • Loading branch information
Li0k committed Jan 25, 2024
2 parents 64d5bda + 90a2139 commit 2001b76
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/frontend/src/catalog/system_catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ prepare_sys_catalog! {
{ BuiltinCatalog::Table(&RW_SYSTEM_TABLES), read_system_table_info },
{ BuiltinCatalog::View(&RW_RELATIONS) },
{ BuiltinCatalog::View(&RW_STREAMING_PARALLELISM) },
{ BuiltinCatalog::View(&RW_FRAGMENT_PARALLELISM) },
{ BuiltinCatalog::Table(&RW_COLUMNS), read_rw_columns_info },
{ BuiltinCatalog::Table(&RW_TYPES), read_rw_types },
{ BuiltinCatalog::Table(&RW_HUMMOCK_PINNED_VERSIONS), read_hummock_pinned_versions await },
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/src/catalog/system_catalog/rw_catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mod rw_databases;
mod rw_ddl_progress;
mod rw_description;
mod rw_event_logs;
mod rw_fragment_parallelism;
mod rw_fragments;
mod rw_functions;
mod rw_hummock_branched_objects;
Expand Down Expand Up @@ -58,6 +59,7 @@ pub use rw_databases::*;
pub use rw_ddl_progress::*;
pub use rw_description::*;
pub use rw_event_logs::*;
pub use rw_fragment_parallelism::*;
pub use rw_fragments::*;
pub use rw_functions::*;
pub use rw_hummock_branched_objects::*;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright 2024 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Copyright 2023 RisingWave Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::sync::LazyLock;

use risingwave_common::catalog::RW_CATALOG_SCHEMA_NAME;
use risingwave_common::types::DataType;

use crate::catalog::system_catalog::{BuiltinView, SystemCatalogColumnsDef};

pub static RW_FRAGMENT_PARALLELISM_COLUMNS: LazyLock<Vec<SystemCatalogColumnsDef<'_>>> =
LazyLock::new(|| {
vec![
(DataType::Int32, "id"),
(DataType::Varchar, "name"),
(DataType::Varchar, "relation_type"),
(DataType::Int32, "fragment_id"),
(DataType::Varchar, "distribution_type"),
(DataType::List(Box::new(DataType::Int32)), "state_table_ids"),
(
DataType::List(Box::new(DataType::Int32)),
"upstream_fragment_ids",
),
(DataType::List(Box::new(DataType::Varchar)), "flags"),
(DataType::Int32, "parallelism"),
]
});
pub static RW_FRAGMENT_PARALLELISM: LazyLock<BuiltinView> = LazyLock::new(|| BuiltinView {
name: "rw_fragment_parallelism",
schema: RW_CATALOG_SCHEMA_NAME,
columns: &RW_FRAGMENT_PARALLELISM_COLUMNS,
sql: "WITH all_streaming_jobs AS ( \
SELECT id, name, 'table' as relation_type FROM rw_tables \
UNION ALL \
SELECT id, name, 'materialized view' as relation_type FROM rw_materialized_views \
UNION ALL \
SELECT id, name, 'sink' as relation_type FROM rw_sinks \
UNION ALL \
SELECT id, name, 'index' as relation_type FROM rw_indexes \
) \
SELECT \
job.id, \
job.name, \
job.relation_type, \
f.fragment_id, \
f.distribution_type, \
f.state_table_ids, \
f.upstream_fragment_ids, \
f.flags, \
f.parallelism \
FROM all_streaming_jobs job \
INNER JOIN rw_fragments f ON job.id = f.table_id \
ORDER BY job.id\
"
.to_string(),
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,7 @@ pub static RW_STREAMING_PARALLELISM_COLUMNS: LazyLock<Vec<SystemCatalogColumnsDe
(DataType::Int32, "id"),
(DataType::Varchar, "name"),
(DataType::Varchar, "relation_type"),
(DataType::Int32, "fragment_id"),
(DataType::Varchar, "distribution_type"),
(DataType::List(Box::new(DataType::Int32)), "state_table_ids"),
(
DataType::List(Box::new(DataType::Int32)),
"upstream_fragment_ids",
),
(DataType::List(Box::new(DataType::Varchar)), "flags"),
(DataType::Int32, "parallelism"),
(DataType::Varchar, "parallelism"),
]
});
pub static RW_STREAMING_PARALLELISM: LazyLock<BuiltinView> = LazyLock::new(|| BuiltinView {
Expand All @@ -67,15 +59,9 @@ pub static RW_STREAMING_PARALLELISM: LazyLock<BuiltinView> = LazyLock::new(|| Bu
job.id, \
job.name, \
job.relation_type, \
f.fragment_id, \
f.distribution_type, \
f.state_table_ids, \
f.upstream_fragment_ids, \
f.flags, \
f.parallelism \
tf.parallelism \
FROM all_streaming_jobs job \
INNER JOIN rw_fragments f ON job.id = f.table_id \
WHERE job.relation_type in ('table', 'materialized view', 'sink', 'index') \
INNER JOIN rw_table_fragments tf ON job.id = tf.table_id \
ORDER BY job.id\
"
.to_string(),
Expand Down

0 comments on commit 2001b76

Please sign in to comment.