Skip to content

Commit

Permalink
cluster lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhiHanZ committed Nov 5, 2021
1 parent a7264dd commit 68e7e73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stateful-tests-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
- name: Rust setup
run: |
bash ./scripts/setup/dev_setup.sh -o -t
- name: Run Stateful Tests with Standalone mode
- name: Run Stateful Tests with Cluster mode
run: |
make stateful-cluster-test
13 changes: 5 additions & 8 deletions cli/src/cmds/loads/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ impl LoadCommand {
async fn local_exec_match(&self, writer: &mut Writer, args: &ArgMatches) -> Result<()> {
match self.local_exec_precheck(args).await {
Ok(_) => {
let mut reader =
build_reader(args.value_of("load"), args.value_of("with_header")).await;
let mut reader = build_reader(args.value_of("load")).await;
let mut record = reader.records();
let table = args.value_of("table").unwrap();
let schema = args.value_of("schema");
Expand Down Expand Up @@ -231,7 +230,7 @@ impl LoadCommand {
if let Err(e) = execute_query_json(&cli, &url, query.clone()).await {
writer.write_err(format!(
"cannot insert data into {} with query {}, error: {:?}",
table,query, e
table, query, e
))
}
}
Expand Down Expand Up @@ -291,15 +290,13 @@ impl LoadCommand {
}
}

async fn build_reader(
load: Option<&str>,
header: Option<&str>,
) -> csv::Reader<Box<dyn std::io::Read + Send + Sync>> {
async fn build_reader(load: Option<&str>) -> csv::Reader<Box<dyn std::io::Read + Send + Sync>> {
match load {
Some(val) => {
if Path::new(val).exists() {
let f = std::fs::File::open(val).expect("cannot open file: permission denied");
csv::ReaderBuilder::new().has_headers(false)
csv::ReaderBuilder::new()
.has_headers(false)
.from_reader(Box::new(f))
} else if val.contains("://") {
let target = reqwest::get(val)
Expand Down
5 changes: 3 additions & 2 deletions scripts/ci/ci-run-stateful-tests-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
# SPDX-License-Identifier: Apache-2.0.
export DATASET_SHA256=429c47cdd49b7d75eec9b9244c8b1288edd132506203e37d2d1e70e1ac1eccc7

echo "Starting standalone databend cluster through bendctl"
echo "Starting 3 nodes databend cluster through bendctl"
killall databend-query
killall databend-meta
make cluster
echo "Bootstrap 3 nodes databend cluster through bendctl"
ADD_NODES=2 NUM_CPUS=1 make cluster
if [ $? -eq 0 ]; then
echo "provisioned cluster"
else
Expand Down

0 comments on commit 68e7e73

Please sign in to comment.