Skip to content

Commit

Permalink
fix(meta): add back host, a deprecated cmd line argument (#7616)
Browse files Browse the repository at this point in the history
risingwave-operator made a [temporary fix](risingwavelabs/risingwave-operator@f011c36) with regards to the breaking change that uses `meta-endpoint` instead of `host`, please refer to #7527.
But the cloud is unable to adopt this change right now, so we add `host` back.


By looking at the temporary fix, it used to use `IP` as `host` and now uses `IP:PORT` as `meta-endpoint`.
So this hot fix uses `IP` from `host` and  `PORT` from `listening-addr` to compose `meta-endpoint`, please correct me if I am wrong.

Approved-By: arkbriar
Approved-By: jon-chuang
  • Loading branch information
lmatz authored Jan 31, 2023
1 parent 9a4ee14 commit b97dd9f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/meta/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ pub struct MetaNodeOpts {
#[clap(long, default_value = "127.0.0.1:5690")]
listen_addr: String,

/// Deprecated. But we keep it for backward compatibility.
#[clap(long)]
host: Option<String>,

/// The endpoint for this meta node, which also serves as its unique identifier in cluster
/// membership and leader election.
#[clap(long)]
Expand Down Expand Up @@ -120,6 +124,7 @@ pub struct MetaNodeOpts {
}

use std::future::Future;
use std::net::SocketAddr;
use std::pin::Pin;

use risingwave_common::config::load_config;
Expand All @@ -132,13 +137,14 @@ pub fn start(opts: MetaNodeOpts) -> Pin<Box<dyn Future<Output = ()> + Send>> {
let config = load_config(&opts.config_path);
tracing::info!("Starting meta node with config {:?}", config);
tracing::info!("Starting meta node with options {:?}", opts);
let listen_addr = opts.listen_addr.parse().unwrap();
let listen_addr: SocketAddr = opts.listen_addr.parse().unwrap();
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
.expect("meta_endpoint must be specified when using etcd"),
.unwrap_or_else(|| format!("{}:{}", meta_addr, listen_addr.port())),
MetaStoreBackend::Etcd {
endpoints: opts
.etcd_endpoints
Expand Down

0 comments on commit b97dd9f

Please sign in to comment.