Skip to content

Commit

Permalink
feat: allow skipping cf contents in "db-utils copy"
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Feb 26, 2024
1 parent 45ea140 commit 0b64cf2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/db_utils/cli/copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub struct Args {
/// Range to query for (or all).
#[command(flatten)]
pub query: ArgsQuery,
/// Names of column families to skip contents for.
#[arg(long)]
pub skip_cfs: Vec<String>,

/// Optional path to RocksDB WAL directory.
#[arg(long)]
Expand Down Expand Up @@ -196,6 +199,11 @@ pub fn run(common: &common::cli::Args, args: &Args) -> Result<(), anyhow::Error>
// Perform the main work of copying over data.
tracing::info!("Copying data");
for cf_name in &cf_names {
if args.skip_cfs.contains(&cf_name) {

Check warning on line 202 in src/db_utils/cli/copy.rs

View workflow job for this annotation

GitHub Actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler --> src/db_utils/cli/copy.rs:202:35 | 202 | if args.skip_cfs.contains(&cf_name) { | ^^^^^^^^ help: change this to: `cf_name` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `#[warn(clippy::needless_borrow)]` on by default
tracing::info!(" skipping column family contents {}", cf_name);
continue;
}

tracing::info!(" copying data from column family {}", cf_name);
if cf_name == "meta" || cf_name.contains("_by_") {
tracing::info!(" ignoring query for column family {}", &cf_name);
Expand Down Expand Up @@ -266,6 +274,7 @@ mod test {
all: true,
},
path_wal_dir: None,
skip_cfs: Vec::new(),
};

run(&common, &args)
Expand All @@ -287,6 +296,7 @@ mod test {
all: false,
},
path_wal_dir: None,
skip_cfs: Vec::new(),
};

run(&common, &args)
Expand All @@ -308,6 +318,7 @@ mod test {
all: false,
},
path_wal_dir: None,
skip_cfs: Vec::new(),
};

run(&common, &args)
Expand Down

0 comments on commit 0b64cf2

Please sign in to comment.