Skip to content

Commit fa9b15e

Browse files
authored
fix(query): add config to the embed mode to clarify this mode (#18710)
* fix(query): add config to the embed mode to clarify this mode * fix(query): add config to the embed mode to clarify this mode * fix(query): add config to the embed mode to clarify this mode
1 parent 364b231 commit fa9b15e

File tree

7 files changed

+17
-8
lines changed

7 files changed

+17
-8
lines changed

.github/actions/build_bindings_python/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ runs:
1818
raw_version="${{ inputs.version }}"
1919
# Remove v prefix and suffixes: v1.2.809-nightly -> 1.2.809
2020
VERSION=$(echo "$raw_version" | sed 's/^v//' | sed 's/-nightly//' | sed 's/-p[0-9]*//')
21-
21+
2222
echo "building version: $raw_version -> $VERSION"
2323
# Replace any existing version in Cargo.toml and pyproject.toml
2424
sed "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml > Cargo.toml.tmp
@@ -117,4 +117,3 @@ runs:
117117
python -m pytest tests/ -v --tb=short
118118
119119
echo "All Python binding tests passed!"
120-

.github/workflows/bindings.python.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ jobs:
4444
echo "Error: No version provided for workflow_call"
4545
exit 1
4646
fi
47-
47+
4848
# Validate version format
4949
if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
5050
echo "Warning: Version $VERSION may not follow semantic versioning (vX.Y.Z)"
5151
fi
52-
52+
5353
echo "Final version: $VERSION"
5454
echo "version=$VERSION" >> $GITHUB_OUTPUT
5555
@@ -116,17 +116,17 @@ jobs:
116116
- uses: actions/checkout@v4
117117
with:
118118
fetch-depth: 0
119-
119+
120120
- name: Install dependencies
121121
run: |
122122
# Install OpenSSL and necessary tools
123123
brew install openssl@3
124-
124+
125125
# Use vendored OpenSSL to avoid cross-compilation issues
126126
echo "OPENSSL_STATIC=1" >> $GITHUB_ENV
127127
echo "OPENSSL_VENDORED=1" >> $GITHUB_ENV
128128
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
129-
129+
130130
- uses: ./.github/actions/build_bindings_python
131131
with:
132132
target: ${{ matrix.target }}

src/bendpy/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ fn create_embedded_config(
8989

9090
// Query configuration
9191
conf.query.tenant_id = Tenant::new_literal("python_binding");
92+
conf.query.embedded_mode = true;
9293
conf.query.cluster_id = "".to_string();
9394
conf.query.warehouse_id = "".to_string();
9495
conf.query.node_id = "embedded_node".to_string();

src/query/config/src/config.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,8 @@ pub struct QueryConfig {
17911791
/// If in management mode, only can do some meta level operations(database/table/user/stage etc.) with metasrv.
17921792
#[clap(long)]
17931793
pub management_mode: bool,
1794+
#[clap(long)]
1795+
pub embedded_mode: bool,
17941796

17951797
/// Deprecated: jwt_key_file is deprecated, use jwt_key_files to add a list of available jwks url
17961798
#[clap(long, value_name = "VALUE", default_value_t)]
@@ -2017,6 +2019,7 @@ impl TryInto<InnerQueryConfig> for QueryConfig {
20172019
max_query_log_size: self.max_query_log_size,
20182020
databend_enterprise_license: self.databend_enterprise_license,
20192021
management_mode: self.management_mode,
2022+
embedded_mode: self.embedded_mode,
20202023
parquet_fast_read_bytes: self.parquet_fast_read_bytes,
20212024
max_storage_io_requests: self.max_storage_io_requests,
20222025
jwt_key_file: self.jwt_key_file,
@@ -2159,6 +2162,7 @@ impl From<InnerQueryConfig> for QueryConfig {
21592162
settings: HashMap::new(),
21602163
resources_management: None,
21612164
enable_queries_executor: inner.enable_queries_executor,
2165+
embedded_mode: inner.embedded_mode,
21622166
}
21632167
}
21642168
}

src/query/config/src/global.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ impl GlobalConfig {
4848
/// Embedded mode is determined by empty cluster_id and warehouse_id
4949
pub fn is_embedded_mode() -> bool {
5050
let config = Self::instance();
51-
config.query.cluster_id.is_empty() && config.query.warehouse_id.is_empty()
51+
config.query.embedded_mode
52+
&& config.query.cluster_id.is_empty()
53+
&& config.query.warehouse_id.is_empty()
5254
}
5355
}

src/query/config/src/inner.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ pub struct QueryConfig {
209209
pub databend_enterprise_license: Option<String>,
210210
/// If in management mode, only can do some meta level operations(database/table/user/stage etc.) with metasrv.
211211
pub management_mode: bool,
212+
pub embedded_mode: bool,
212213

213214
pub parquet_fast_read_bytes: Option<u64>,
214215
pub max_storage_io_requests: Option<u64>,
@@ -302,6 +303,7 @@ impl Default for QueryConfig {
302303
max_query_log_size: 10_000,
303304
databend_enterprise_license: None,
304305
management_mode: false,
306+
embedded_mode: false,
305307
parquet_fast_read_bytes: None,
306308
max_storage_io_requests: None,
307309
jwt_key_file: "".to_string(),

src/query/service/tests/it/storages/testdata/configs_table_basic.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ DB.Table: 'system'.'configs', Table: configs-table_id:1, ver:0, Engine: SystemCo
163163
| 'query' | 'default_storage_format' | 'auto' | '' |
164164
| 'query' | 'disable_system_table_load' | 'false' | '' |
165165
| 'query' | 'discovery_address' | '' | '' |
166+
| 'query' | 'embedded_mode' | 'false' | '' |
166167
| 'query' | 'enable_meta_data_upgrade_json_to_pb_from_v307' | 'false' | '' |
167168
| 'query' | 'enable_queries_executor' | 'false' | '' |
168169
| 'query' | 'enable_udf_js_script' | 'true' | '' |

0 commit comments

Comments
 (0)