fix(metasrv)!: do not overwrite boolean options unconditionally (#2161)

* fix: do not overwrite boolean options unconditionally

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

* fix sqlness start command

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>

---------

Signed-off-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
Ruihang Xia
2023-08-14 11:04:54 +08:00
committed by GitHub
parent 7f51141ed0
commit f6b53984da
3 changed files with 15 additions and 5 deletions

View File

@@ -91,9 +91,9 @@ struct StartCommand {
#[clap(short, long)]
selector: Option<String>,
#[clap(long)]
use_memory_store: bool,
use_memory_store: Option<bool>,
#[clap(long)]
disable_region_failover: bool,
disable_region_failover: Option<bool>,
#[clap(long)]
http_addr: Option<String>,
#[clap(long)]
@@ -136,9 +136,13 @@ impl StartCommand {
.context(error::UnsupportedSelectorTypeSnafu { selector_type })?;
}
opts.use_memory_store = self.use_memory_store;
if let Some(use_memory_store) = self.use_memory_store {
opts.use_memory_store = use_memory_store;
}
opts.disable_region_failover = self.disable_region_failover;
if let Some(disable_region_failover) = self.disable_region_failover {
opts.disable_region_failover = disable_region_failover;
}
if let Some(http_addr) = &self.http_addr {
opts.http_opts.addr = http_addr.clone();

View File

@@ -106,7 +106,11 @@ pub enum Error {
#[snafu(display("Empty key is not allowed"))]
EmptyKey { location: Location },
#[snafu(display("Failed to execute via Etcd, source: {}", source))]
#[snafu(display(
"Failed to execute via Etcd, source: {}, location: {}",
source,
location
))]
EtcdFailed {
source: etcd_client::Error,
location: Location,

View File

@@ -177,8 +177,10 @@ impl Env {
subcommand.to_string(),
"start".to_string(),
"--use-memory-store".to_string(),
"true".to_string(),
"--http-addr=127.0.0.1:5001".to_string(),
"--disable-region-failover".to_string(),
"true".to_string(),
];
(args, METASRV_ADDR.to_string())
}