Skip to content

Commit 7641b15

Browse files
authored
feat(test): add e2e test for OpenDAL fs backend (risingwavelabs#8528)
1 parent 65a641d commit 7641b15

File tree

9 files changed

+164
-1
lines changed

9 files changed

+164
-1
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
# Exits as soon as any line fails.
4+
set -euo pipefail
5+
6+
source ci/scripts/common.env.sh
7+
8+
while getopts 'p:' opt; do
9+
case ${opt} in
10+
p )
11+
profile=$OPTARG
12+
;;
13+
\? )
14+
echo "Invalid Option: -$OPTARG" 1>&2
15+
exit 1
16+
;;
17+
: )
18+
echo "Invalid option: $OPTARG requires an argument" 1>&2
19+
;;
20+
esac
21+
done
22+
shift $((OPTIND -1))
23+
24+
echo "--- Download artifacts"
25+
mkdir -p target/debug
26+
buildkite-agent artifact download risingwave-"$profile" target/debug/
27+
buildkite-agent artifact download risedev-dev-"$profile" target/debug/
28+
buildkite-agent artifact download "e2e_test/generated/*" ./
29+
mv target/debug/risingwave-"$profile" target/debug/risingwave
30+
mv target/debug/risedev-dev-"$profile" target/debug/risedev-dev
31+
32+
echo "--- Adjust permission"
33+
chmod +x ./target/debug/risingwave
34+
chmod +x ./target/debug/risedev-dev
35+
36+
echo "--- Generate RiseDev CI config"
37+
cp ci/risedev-components.ci.env risedev-components.user.env
38+
39+
echo "--- Prepare RiseDev dev cluster"
40+
cargo make pre-start-dev
41+
cargo make link-all-in-one-binaries
42+
43+
host_args="-h localhost -p 4565 -h localhost -p 4566 -h localhost -p 4567"
44+
45+
echo "--- e2e, ci-3cn-3fe-opendal-fs-backend, streaming"
46+
RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=info" \
47+
cargo make ci-start ci-3cn-3fe-opendal-fs-backend
48+
sqllogictest ${host_args} -d dev './e2e_test/streaming/**/*.slt' -j 16 --junit "parallel-opendal-fs-backend-${profile}"
49+
50+
echo "--- Kill cluster"
51+
rm -rf /tmp/rw_ci
52+
cargo make ci-kill
53+
54+
55+
echo "--- e2e, ci-3cn-3fe-opendal-fs-backend, batch"
56+
RUST_LOG="info,risingwave_stream=info,risingwave_batch=info,risingwave_storage=info" \
57+
cargo make ci-start ci-3cn-3fe-opendal-fs-backend
58+
sqllogictest ${host_args} -d dev './e2e_test/ddl/**/*.slt' --junit "parallel-opendal-fs-backend-ddl-${profile}"
59+
sqllogictest ${host_args} -d dev './e2e_test/batch/**/*.slt' -j 16 --junit "parallel-opendal-fs-backend-batch-${profile}"
60+
61+
echo "--- Kill cluster"
62+
rm -rf /tmp/rw_ci
63+
cargo make ci-kill

ci/scripts/e2e-test-parallel-in-memory.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ sqllogictest ${host_args} -d dev './e2e_test/ddl/**/*.slt' --junit "parallel-in
5454
sqllogictest ${host_args} -d dev './e2e_test/batch/**/*.slt' -j 16 --junit "parallel-in-memory-batch-${profile}"
5555

5656
echo "--- Kill cluster"
57-
cargo make ci-kill
57+
cargo make ci-kill

ci/workflows/pull-request.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,21 @@ steps:
113113
timeout_in_minutes: 12
114114
retry: *auto-retry
115115

116+
- label: "end-to-end test for opendal (parallel)"
117+
command: "ci/scripts/e2e-test-parallel-for-opendal.sh -p ci-dev"
118+
depends_on:
119+
- "build"
120+
- "docslt"
121+
plugins:
122+
- gencer/cache#v2.4.10: *cargo-cache
123+
- docker-compose#v4.9.0:
124+
run: rw-build-env
125+
config: ci/docker-compose.yml
126+
mount-buildkite-agent: true
127+
- ./ci/plugins/upload-failure-logs
128+
timeout_in_minutes: 12
129+
retry: *auto-retry
130+
116131
- label: "end-to-end test (parallel, in-memory)"
117132
command: "ci/scripts/e2e-test-parallel-in-memory.sh -p ci-dev"
118133
depends_on: "build"

risedev.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,39 @@ profile:
499499
exporter-port: 2224
500500
health-check-port: 6788
501501

502+
ci-3cn-3fe-opendal-fs-backend:
503+
config-path: src/config/ci.toml
504+
steps:
505+
# - use: etcd
506+
# unsafe-no-fsync: true
507+
- use: meta-node
508+
- use: opendal
509+
engine: fs
510+
bucket: ""
511+
root: /tmp/rw_ci
512+
- use: compute-node
513+
port: 5687
514+
exporter-port: 1222
515+
- use: compute-node
516+
port: 5688
517+
exporter-port: 1223
518+
- use: compute-node
519+
port: 5689
520+
exporter-port: 1224
521+
- use: frontend
522+
port: 4565
523+
exporter-port: 2222
524+
health-check-port: 6786
525+
- use: frontend
526+
port: 4566
527+
exporter-port: 2223
528+
health-check-port: 6787
529+
- use: frontend
530+
port: 4567
531+
exporter-port: 2224
532+
health-check-port: 6788
533+
- use: compactor
534+
502535
ci-pubsub:
503536
config-path: src/config/ci.toml
504537
steps:

src/object_store/src/object/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,15 @@ pub async fn parse_remote_object_store(
857857
.monitored(metrics),
858858
)
859859
}
860+
fs if fs.starts_with("fs://") => {
861+
let fs = fs.strip_prefix("fs://").unwrap();
862+
let (_, root) = fs.split_once('@').unwrap();
863+
ObjectStoreImpl::Opendal(
864+
OpendalObjectStore::new_fs_engine(root.to_string())
865+
.unwrap()
866+
.monitored(metrics),
867+
)
868+
}
860869
s3_compatible if s3_compatible.starts_with("s3-compatible://") => {
861870
ObjectStoreImpl::S3Compatible(
862871
S3ObjectStore::new_s3_compatible(
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright 2023 RisingWave Labs
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
use opendal::services::Fs;
16+
use opendal::Operator;
17+
18+
use super::{EngineType, OpendalObjectStore};
19+
use crate::object::ObjectResult;
20+
impl OpendalObjectStore {
21+
/// create opendal fs engine.
22+
pub fn new_fs_engine(root: String) -> ObjectResult<Self> {
23+
// Create fs backend builder.
24+
let mut builder = Fs::default();
25+
26+
builder.root(&root);
27+
28+
let op: Operator = Operator::new(builder)?.finish();
29+
Ok(Self {
30+
op,
31+
engine_type: EngineType::Fs,
32+
})
33+
}
34+
}

src/object_store/src/object/opendal_engine/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ pub mod gcs;
2626
pub use gcs::*;
2727
pub mod oss;
2828
pub use oss::*;
29+
pub mod fs;
30+
pub use fs::*;

src/object_store/src/object/opendal_engine/opendal_object_store.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ pub enum EngineType {
3939
Gcs,
4040
Oss,
4141
Webhdfs,
42+
Fs,
4243
}
4344

4445
impl OpendalObjectStore {
@@ -185,6 +186,7 @@ impl ObjectStore for OpendalObjectStore {
185186
EngineType::Gcs => "Gcs",
186187
EngineType::Oss => "Oss",
187188
EngineType::Webhdfs => "Webhdfs",
189+
EngineType::Fs => "Fs",
188190
}
189191
}
190192
}

src/risedevtool/src/task/utils.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ pub fn add_storage_backend(
117117
.arg(format!("hummock+webhdfs://{}@{}", opendal.namenode, opendal.root));
118118
true
119119
}
120+
else if opendal.engine == "fs"{
121+
cmd.arg("--state-store")
122+
.arg(format!("hummock+fs://{}@{}", opendal.namenode, opendal.root));
123+
true
124+
}
120125
else{
121126
unimplemented!()
122127
}

0 commit comments

Comments
 (0)