WIP on bug fix

This commit is contained in:
Dominik Werder
2021-05-13 16:38:46 +02:00
parent 21aa59e0d0
commit 70426e8e48
8 changed files with 22 additions and 15 deletions

View File

@@ -69,11 +69,10 @@ pub async fn table_sizes(node_config: &NodeConfigCached) -> Result<TableSizes, E
let cl = create_connection(node_config).await?;
let rows = cl.query(sql, &[]).await?;
let mut sizes = TableSizes { sizes: vec![] };
sizes.sizes.push((format!("table"), format!("size")));
for row in rows {
sizes.sizes.push((row.get(0), row.get(1)));
}
sizes.sizes.push((format!("dummy0"), format!("A")));
sizes.sizes.push((format!("dummy1"), format!("B")));
Ok(sizes)
}

View File

@@ -239,6 +239,9 @@ where
continue 'outer;
}
} else {
// TODO make sure that we don't poll our input here after it has completed.
err::todo();
let cur = self.cur(cx);
match self.handle(cur) {
Some(item) => item,

View File

@@ -27,7 +27,7 @@ impl PreBinnedValueFetchedStream {
let nodeix = node_ix_for_patch(&query.patch, &query.channel, &node_config.node_config.cluster);
let node = &node_config.node_config.cluster.nodes[nodeix as usize];
let uri: hyper::Uri = format!(
"http://{}:{}/api/1/prebinned?{}",
"http://{}:{}/api/4/prebinned?{}",
node.host,
node.port,
query.make_query_string()

View File

@@ -86,44 +86,49 @@ impl<F> UnwindSafe for Cont<F> {}
async fn data_api_proxy_try(req: Request<Body>, node_config: &NodeConfigCached) -> Result<Response<Body>, Error> {
let uri = req.uri().clone();
let path = uri.path();
if path == "/api/1/node_status" {
if path == "/api/4/node_status" {
if req.method() == Method::GET {
Ok(node_status(req, &node_config).await?)
} else {
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
}
} else if path == "/api/1/table_sizes" {
} else if path == "/api/4/table_sizes" {
if req.method() == Method::GET {
Ok(table_sizes(req, &node_config).await?)
} else {
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
}
} else if path == "/api/1/random_channel" {
} else if path == "/api/4/random_channel" {
if req.method() == Method::GET {
Ok(random_channel(req, &node_config).await?)
} else {
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
}
} else if path == "/api/1/parsed_raw" {
} else if path == "/api/4/parsed_raw" {
if req.method() == Method::POST {
Ok(parsed_raw(req, &node_config.node).await?)
} else {
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
}
} else if path == "/api/1/binned" {
} else if path == "/api/4/binned" {
if req.method() == Method::GET {
Ok(binned(req, node_config).await?)
} else {
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
}
} else if path == "/api/1/prebinned" {
} else if path == "/api/4/prebinned" {
if req.method() == Method::GET {
Ok(prebinned(req, &node_config).await?)
} else {
Ok(response(StatusCode::METHOD_NOT_ALLOWED).body(Body::empty())?)
}
} else {
Ok(response(StatusCode::NOT_FOUND).body(Body::empty())?)
Ok(response(StatusCode::NOT_FOUND).body(Body::from(format!(
"Sorry, not found: {:?} {:?} {:?}",
req.method(),
req.uri().path(),
req.uri().query(),
)))?)
}
}

View File

@@ -121,7 +121,7 @@ fn simple_fetch() {
let host = tokio::spawn(httpret::host(node_config.clone()));
let req = hyper::Request::builder()
.method(http::Method::POST)
.uri("http://localhost:8360/api/1/parsed_raw")
.uri("http://localhost:8360/api/4/parsed_raw")
.body(query_string.into())?;
let client = hyper::Client::new();
let res = client.request(req).await?;

View File

@@ -12,7 +12,7 @@ use netpod::PerfOpts;
pub async fn status(host: String, port: u16) -> Result<(), Error> {
let t1 = Utc::now();
let uri = format!("http://{}:{}/api/1/node_status", host, port,);
let uri = format!("http://{}:{}/api/4/node_status", host, port,);
let req = hyper::Request::builder()
.method(http::Method::GET)
.uri(uri)
@@ -47,7 +47,7 @@ pub async fn get_binned(
let t1 = Utc::now();
let date_fmt = "%Y-%m-%dT%H:%M:%S.%3fZ";
let uri = format!(
"http://{}:{}/api/1/binned?channel_backend={}&channel_name={}&beg_date={}&end_date={}&bin_count={}&cache_usage={}&disk_stats_every_kb={}",
"http://{}:{}/api/4/binned?channel_backend={}&channel_name={}&beg_date={}&end_date={}&bin_count={}&cache_usage={}&disk_stats_every_kb={}",
host,
port,
channel_backend,

View File

@@ -99,7 +99,7 @@ where
let disk_stats_every = ByteSize::kb(1024);
// TODO have a function to form the uri, including perf opts:
let uri = format!(
"http://{}:{}/api/1/binned?cache_usage=ignore&channel_backend={}&channel_name={}&bin_count={}&beg_date={}&end_date={}&disk_stats_every_kb={}",
"http://{}:{}/api/4/binned?cache_usage=ignore&channel_backend={}&channel_name={}&bin_count={}&beg_date={}&end_date={}&disk_stats_every_kb={}",
node0.host,
node0.port,
channel_backend,

View File

@@ -41,7 +41,7 @@ async fn get_binned_json_0_inner2(
let disk_stats_every = ByteSize::kb(1024);
// TODO have a function to form the uri, including perf opts:
let uri = format!(
"http://{}:{}/api/1/binned?cache_usage=ignore&channel_backend={}&channel_name={}&bin_count={}&beg_date={}&end_date={}&disk_stats_every_kb={}",
"http://{}:{}/api/4/binned?cache_usage=ignore&channel_backend={}&channel_name={}&bin_count={}&beg_date={}&end_date={}&disk_stats_every_kb={}",
node0.host,
node0.port,
channel_backend,