convert_db: allow LMDB map size override #691

Merged
lx merged 4 commits from zdenek.crha/garage:convert_db_lmdb_map_size into main 2024-01-24 08:19:45 +00:00
Showing only changes of commit 74e72fc996 - Show all commits

View file

@ -24,10 +24,10 @@ pub struct ConvertDbOpt {
output_engine: Engine,
#[structopt(flatten)]
output_open: OpenDbOpt,
db_open: OpenDbOpt,
zdenek.crha marked this conversation as resolved Outdated
Outdated
Review

This is no longer specific to the output db, so maybe rename it db_open ?

This is no longer specific to the output db, so maybe rename it `db_open` ?
}
/// Open database config overrides
/// Overrides for database open operation
#[derive(StructOpt, Debug, Default)]
pub struct OpenDbOpt {
#[cfg(feature = "lmdb")]
@ -35,11 +35,11 @@ pub struct OpenDbOpt {
lmdb: OpenLmdbOpt,
}
/// Output LMDB database config overrides
/// Overrides for LMDB database open operation
#[cfg(feature = "lmdb")]
#[derive(StructOpt, Debug, Default)]
pub struct OpenLmdbOpt {
/// Output LMDB map size override
/// LMDB map size override
zdenek.crha marked this conversation as resolved Outdated
Outdated
Review

Similarly, comment should be updated to say that it applies to either input or output db

Similarly, comment should be updated to say that it applies to either input or output db
/// (supported suffixes: B, KiB, MiB, GiB, TiB, PiB)
#[cfg(feature = "lmdb")]
#[structopt(long = "lmdb-map-size", name = "bytes", display_order = 1_000)]
@ -51,8 +51,8 @@ pub(crate) fn do_conversion(args: ConvertDbOpt) -> Result<()> {
return Err(Error("input and output database engine must differ".into()));
}
let input = open_db(args.input_path, args.input_engine, &args.output_open)?;
let output = open_db(args.output_path, args.output_engine, &args.output_open)?;
let input = open_db(args.input_path, args.input_engine, &args.db_open)?;
let output = open_db(args.output_path, args.output_engine, &args.db_open)?;
output.import(&input)?;
Ok(())
}