Skip to content

Commit

Permalink
fix(meta): backward compatible with host when running in mem meta bac…
Browse files Browse the repository at this point in the history
…kend (#7628)

See #7616, the previous pr only changes the etcd backend. It fails when running mem backend.

Now both etcd backend and mem backend run with the same `meta-endpoint` when `meta-endpoint` is not provided,
i.e. `format!("{}:{}", meta_addr, listen_addr.port())`

Approved-By: arkbriar
  • Loading branch information
lmatz authored Jan 31, 2023
1 parent db4f27e commit 1ac6da8
Showing 1 changed file with 15 additions and 20 deletions.
35 changes: 15 additions & 20 deletions src/meta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,27 +141,22 @@ pub fn start(opts: MetaNodeOpts) -> Pin<Box<dyn Future<Output = ()> + Send>> {
let meta_addr = opts.host.unwrap_or_else(|| opts.listen_addr.clone());
let dashboard_addr = opts.dashboard_host.map(|x| x.parse().unwrap());
let prometheus_addr = opts.prometheus_host.map(|x| x.parse().unwrap());
let (meta_endpoint, backend) = match opts.backend {
Backend::Etcd => (
opts.meta_endpoint
.unwrap_or_else(|| format!("{}:{}", meta_addr, listen_addr.port())),
MetaStoreBackend::Etcd {
endpoints: opts
.etcd_endpoints
.split(',')
.map(|x| x.to_string())
.collect(),
credentials: match opts.etcd_auth {
true => Some((opts.etcd_username, opts.etcd_password)),
false => None,
},
let meta_endpoint = opts
.meta_endpoint
.unwrap_or_else(|| format!("{}:{}", meta_addr, listen_addr.port()));
let backend = match opts.backend {
Backend::Etcd => MetaStoreBackend::Etcd {
endpoints: opts
.etcd_endpoints
.split(',')
.map(|x| x.to_string())
.collect(),
credentials: match opts.etcd_auth {
true => Some((opts.etcd_username, opts.etcd_password)),
false => None,
},
),
Backend::Mem => (
opts.meta_endpoint
.unwrap_or_else(|| opts.listen_addr.clone()),
MetaStoreBackend::Mem,
),
},
Backend::Mem => MetaStoreBackend::Mem,
};

let max_heartbeat_interval =
Expand Down

0 comments on commit 1ac6da8

Please sign in to comment.