Skip to content

Commit

Permalink
feat(sst-dump): support more features (risingwavelabs#8580)
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxa21 authored Mar 22, 2023
1 parent 8648ff8 commit 655d2bd
Show file tree
Hide file tree
Showing 13 changed files with 312 additions and 114 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

12 changes: 10 additions & 2 deletions src/ctl/src/cmd_impl/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use size::Size;
use tokio::task::JoinHandle;

use super::table::{get_table_catalog, make_state_table};
use crate::common::HummockServiceOpts;
use crate::CtlContext;

#[derive(Subcommand)]
Expand All @@ -37,6 +38,7 @@ pub enum BenchCommands {
/// number of futures doing scan
#[clap(long, default_value_t = 1)]
threads: usize,
data_dir: Option<String>,
},
}

Expand Down Expand Up @@ -74,11 +76,17 @@ impl InterestedMetrics {

pub async fn do_bench(context: &CtlContext, cmd: BenchCommands) -> Result<()> {
let meta = context.meta_client().await?;
let (hummock, metrics) = context.hummock_store_with_metrics().await?;
let next_cnt = Arc::new(AtomicU64::new(0));
let iter_cnt = Arc::new(AtomicU64::new(0));
match cmd {
BenchCommands::Scan { mv_name, threads } => {
BenchCommands::Scan {
mv_name,
threads,
data_dir,
} => {
let (hummock, metrics) = context
.hummock_store_with_metrics(HummockServiceOpts::from_env(data_dir)?)
.await?;
let table = get_table_catalog(meta.clone(), mv_name).await?;
let mut handlers = vec![];
for i in 0..threads {
Expand Down
12 changes: 10 additions & 2 deletions src/ctl/src/cmd_impl/hummock/list_kv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,18 @@ use core::ops::Bound::Unbounded;
use risingwave_common::catalog::TableId;
use risingwave_storage::store::{PrefetchOptions, ReadOptions, StateStoreReadExt};

use crate::common::HummockServiceOpts;
use crate::CtlContext;

pub async fn list_kv(context: &CtlContext, epoch: u64, table_id: u32) -> anyhow::Result<()> {
let hummock = context.hummock_store().await?;
pub async fn list_kv(
context: &CtlContext,
epoch: u64,
table_id: u32,
data_dir: Option<String>,
) -> anyhow::Result<()> {
let hummock = context
.hummock_store(HummockServiceOpts::from_env(data_dir)?)
.await?;
if epoch == u64::MAX {
tracing::info!("using u64::MAX as epoch");
}
Expand Down
Loading

0 comments on commit 655d2bd

Please sign in to comment.