Skip to content

Commit 581bf25

Browse files
authored
Merge pull request #9177 from ZhiHanZ/open-sharing
feat: add prototype open sharing and add sharing stateful tests
2 parents 952070e + a3ba2fe commit 581bf25

32 files changed

+1275
-5
lines changed

.github/actions/artifact_download/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ runs:
5959
aws s3 cp \
6060
s3://databend-ci/${{ inputs.profile }}/${{ inputs.sha }}/${{ inputs.target }}/${{ inputs.category }}/ \
6161
${{ steps.info.outputs.path }}/ --recursive --exclude "*" --include "databend-*" --no-progress
62+
aws s3 cp \
63+
s3://databend-ci/${{ inputs.profile }}/${{ inputs.sha }}/${{ inputs.target }}/${{ inputs.category }}/ \
64+
${{ steps.info.outputs.path }}/ --recursive --exclude "*" --include "open-sharing" --no-progress || true
6265
6366
- name: make artifacts excutable
6467
shell: bash
6568
run: |
6669
chmod +x ${{ steps.info.outputs.path }}/databend-*
70+
chmod +x ${{ steps.info.outputs.path }}/open-sharing || true

.github/actions/artifact_upload/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ runs:
4646
for line in $(ls ./target/${{ inputs.target }}/${{ inputs.profile }}/databend-*); do
4747
aws s3 cp $line s3://databend-ci/${{ inputs.profile }}/${{ inputs.sha }}/${{ inputs.target }}/${{ inputs.category }}/ --no-progress
4848
done
49+
aws s3 cp ./target/${{ inputs.target }}/${{ inputs.profile }}/open-sharing s3://databend-ci/${{ inputs.profile }}/${{ inputs.sha }}/${{ inputs.target }}/${{ inputs.category }}/ --no-progress || true

Cargo.lock

Lines changed: 26 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ members = [
3030
"src/query/catalog",
3131
"src/query/datablocks",
3232
"src/query/sharing",
33+
"src/query/sharing-endpoint",
3334
"src/query/datavalues",
3435
"src/query/expression",
3536
"src/query/formats",
@@ -76,6 +77,7 @@ members = [
7677
"src/meta/protos",
7778
# databend-meta
7879
"src/meta/service",
80+
7981
]
8082

8183
[workspace.dependencies]

scripts/build/build-debug.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
88
cd "$SCRIPT_PATH/../.." || exit
99

1010
echo "Build(DEBUG) start..."
11-
cargo build --bin=databend-query --bin=databend-meta --bin=databend-metactl
11+
cargo build --bin=databend-query --bin=databend-meta --bin=databend-metactl --bin=open-sharing
1212
echo "All done..."

scripts/build/build-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
88
cd "$SCRIPT_PATH/../.." || exit
99

1010
echo "Build(RELEASE) start..."
11-
cargo build --bin=databend-query --bin=databend-meta --bin=databend-metactl --release
11+
cargo build --bin=databend-query --bin=databend-meta --bin=databend-metactl --bin=open-sharing --release
1212
echo "All done..."

scripts/ci/ci-run-stateful-tests-standalone-s3.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export STORAGE_S3_ENDPOINT_URL=http://127.0.0.1:9900
1717
export STORAGE_S3_ACCESS_KEY_ID=minioadmin
1818
export STORAGE_S3_SECRET_ACCESS_KEY=minioadmin
1919
export STORAGE_ALLOW_INSECURE=true
20+
export ALLOW_SHARING=true
2021

2122
echo "Install dependence"
2223
python3 -m pip install --quiet mysql-connector-python
@@ -25,8 +26,19 @@ echo "calling test suite"
2526
echo "Starting standalone DatabendQuery(debug)"
2627
./scripts/ci/deploy/databend-query-standalone.sh
2728

29+
# only expected to get adopted in stateful tests
30+
if [[ "$ALLOW_SHARING" == "true" ]]; then
31+
./scripts/ci/deploy/databend-query-sharing.sh
32+
fi
33+
2834
SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
2935
cd "$SCRIPT_PATH/../../tests" || exit
3036

3137
echo "Starting databend-test"
38+
3239
./databend-test $1 --mode 'standalone' --run-dir 1_stateful
40+
41+
# only expected to get adopted in stateful tests
42+
if [[ "$ALLOW_SHARING" == "true" ]]; then
43+
./databend-test $1 --mode 'standalone' --run-dir 3_stateful_sharing
44+
fi
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Usage:
2+
# databend-query -c databend_query_config_spec.toml
3+
4+
[query]
5+
max_active_sessions = 256
6+
wait_timeout_mills = 5000
7+
8+
# For flight rpc.
9+
flight_api_address = "0.0.0.0:59091"
10+
11+
# Databend Query http address.
12+
# For admin RESET API.
13+
admin_api_address = "0.0.0.0:58080"
14+
15+
# Databend Query metrics RESET API.
16+
metric_api_address = "0.0.0.0:57070"
17+
18+
# Databend Query MySQL Handler.
19+
mysql_handler_host = "0.0.0.0"
20+
mysql_handler_port = 53307
21+
22+
# Databend Query ClickHouse Handler.
23+
clickhouse_http_handler_host = "0.0.0.0"
24+
clickhouse_http_handler_port = 58124
25+
26+
# Databend Query HTTP Handler.
27+
http_handler_host = "0.0.0.0"
28+
http_handler_port = 58000
29+
30+
tenant_id = "shared_tenant"
31+
cluster_id = "test_cluster"
32+
33+
table_engine_memory_enabled = true
34+
database_engine_github_enabled = true
35+
36+
table_cache_enabled = true
37+
table_memory_cache_mb_size = 1024
38+
table_disk_cache_root = "_cache"
39+
table_disk_cache_mb_size = 10240
40+
table_cache_bloom_index_meta_count=3000
41+
table_cache_bloom_index_data_bytes=1073741824
42+
43+
share_endpoint_address = "127.0.0.1:33003" # receive shared information from open sharing
44+
# [[query.users]]
45+
# name = "admin"
46+
# auth_type = "no_password"
47+
48+
# [[query.users]]
49+
# name = "databend"
50+
# auth_type = "double_sha1_password"
51+
# # echo -n "databend" | sha1sum | cut -d' ' -f1 | xxd -r -p | sha1sum
52+
# auth_string = "3081f32caef285c232d066033c89a78d88a6d8a5"
53+
54+
# [[query.users]]
55+
# name = "datafuselabs"
56+
# auth_type = "sha256_password"
57+
# # echo -n "datafuselabs" | sha256sum
58+
# auth_string = "6db1a2f5da402b43c066fcadcbf78f04260b3236d9035e44dd463f21e29e6f3b"
59+
60+
61+
[log]
62+
63+
[log.file]
64+
level = "ERROR"
65+
format = "text"
66+
dir = "./.databend/logs_1"
67+
68+
[meta]
69+
endpoints = ["0.0.0.0:9191"]
70+
username = "root"
71+
password = "root"
72+
client_timeout_in_second = 60
73+
auto_sync_interval = 60
74+
75+
# Storage config.
76+
[storage]
77+
# fs | s3 | azblob | obs | oss
78+
type = "fs"
79+
80+
# Set a local folder to store your data.
81+
# Comment out this block if you're NOT using local file system as storage.
82+
[storage.fs]
83+
data_path = "./.databend/stateless_test_data"
84+
85+
# To use S3-compatible object storage, uncomment this block and set your values.
86+
# [storage.s3]
87+
# bucket = "<your-bucket-name>"
88+
# endpoint_url = "<your-endpoint>"
89+
# access_key_id = "<your-key-id>"
90+
# secret_access_key = "<your-account-key>"
91+
# enable_virtual_host_style = false
92+
93+
# To use Azure Blob storage, uncomment this block and set your values.
94+
# [storage.azblob]
95+
# endpoint_url = "https://<your-storage-account-name>.blob.core.windows.net"
96+
# container = "<your-azure-storage-container-name>"
97+
# account_name = "<your-storage-account-name>"
98+
# account_key = "<your-account-key>"
99+
100+
# To use OBS object storage, uncomment this block and set your values.
101+
# [storage.obs]
102+
# bucket = "<your-bucket-name>"
103+
# endpoint_url = "<your-endpoint>"
104+
# access_key_id = "<your-key-id>"
105+
# secret_access_key = "<your-account-key>"
106+
107+
# To use OSS object storage, uncomment this block and set your values.
108+
# [storage.oss]
109+
# bucket = "<your-bucket-name>"
110+
# endpoint_url = "<your-endpoint>"
111+
# access_key_id = "<your-key-id>"
112+
# access_key_secret = "<your-account-key>"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
# Copyright 2022 The Databend Authors.
3+
# SPDX-License-Identifier: Apache-2.0.
4+
set -e
5+
6+
SCRIPT_PATH="$(cd "$(dirname "$0")" >/dev/null 2>&1 && pwd)"
7+
cd "$SCRIPT_PATH/../../.." || exit
8+
BUILD_PROFILE=${BUILD_PROFILE:-debug}
9+
10+
echo "*************************************"
11+
echo "* Test on Databend openSharing endpoint *"
12+
echo "* it will start a node from another tenant *"
13+
echo "* Please make sure that S3 backend *"
14+
echo "* is ready, and configured properly. *"
15+
echo "*************************************"
16+
echo "Start open-sharing..."
17+
export TENANT=test_tenant
18+
nohup target/${BUILD_PROFILE}/open-sharing &
19+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 33003
20+
21+
echo 'Start databend-query...'
22+
export STORAGE_S3_ROOT=shared
23+
24+
nohup target/${BUILD_PROFILE}/databend-query -c scripts/ci/deploy/config/databend-query-node-shared.toml &
25+
26+
python3 scripts/ci/wait_tcp.py --timeout 5 --port 53307

scripts/ci/deploy/databend-query-standalone.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ BUILD_PROFILE=${BUILD_PROFILE:-debug}
1010

1111
killall databend-query || true
1212
killall databend-meta || true
13+
killall open-sharing || true
1314
sleep 1
1415

1516
for bin in databend-query databend-meta; do

0 commit comments

Comments
 (0)