Skip to content

Commit 5945e57

Browse files
authored
chore(query): refine startup message (#18496)
* chore(query): refine startup message * chore(query): refine startup message
1 parent ed005a8 commit 5945e57

File tree

18 files changed

+43
-86
lines changed

18 files changed

+43
-86
lines changed

src/binaries/query/entry.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -395,29 +395,24 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
395395
" connect via: mysql -u${{USER}} -p${{PASSWORD}} -h{} -P{}",
396396
conf.query.mysql_handler_host, conf.query.mysql_handler_port
397397
);
398-
println!("Clickhouse(http)");
398+
println!("Databend");
399399
println!(
400400
" listened at {}:{}",
401-
conf.query.clickhouse_http_handler_host, conf.query.clickhouse_http_handler_port
401+
conf.query.http_handler_host, conf.query.http_handler_port
402402
);
403+
403404
println!(
404-
" usage: {}",
405-
HttpHandlerKind::Clickhouse.usage(
406-
format!(
407-
"{}:{}",
408-
conf.query.clickhouse_http_handler_host, conf.query.clickhouse_http_handler_port
409-
)
410-
.parse()
411-
.with_context(make_error)?
412-
)
405+
" usage with args: bendsql -u ${{USER}} -p ${{PASSWORD}} -h {} -P {}",
406+
conf.query.http_handler_host, conf.query.http_handler_port
413407
);
414-
println!("Databend HTTP");
408+
415409
println!(
416-
" listened at {}:{}",
410+
" usage with dsn: bendsql --dsn \"databend://${{USER}}:${{PASSWORD}}@{}:{}?sslmode=disable\"",
417411
conf.query.http_handler_host, conf.query.http_handler_port
418412
);
413+
419414
println!(
420-
" usage: {}",
415+
" http: {}",
421416
HttpHandlerKind::Query.usage(
422417
format!(
423418
"{}:{}",
@@ -427,6 +422,7 @@ pub async fn start_services(conf: &InnerConfig) -> Result<(), MainError> {
427422
.with_context(make_error)?
428423
)
429424
);
425+
430426
for (idx, (k, v)) in env::vars()
431427
.filter(|(k, _)| k.starts_with("_DATABEND"))
432428
.enumerate()

src/common/exception/src/exception.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,14 @@ impl<C> ErrorCode<C> {
260260
}
261261
}
262262

263+
impl ErrorCode {
264+
pub fn aborting() -> Self {
265+
ErrorCode::AbortedQuery(
266+
"Aborted query, because the server is shutting down or the query was killed.",
267+
)
268+
}
269+
}
270+
263271
/// Provides the `map_err_to_code` method for `Result`.
264272
///
265273
/// ```

src/query/pipeline/transforms/src/processors/transforms/transform_compact_block.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ impl BlockMetaTransform<BlockCompactMeta> for TransformCompactBlock {
6060

6161
fn transform(&mut self, meta: BlockCompactMeta) -> Result<Vec<DataBlock>> {
6262
if unlikely(self.aborting.load(Ordering::Relaxed)) {
63-
return Err(ErrorCode::AbortedQuery(
64-
"Aborted query, because the server is shutting down or the query was killed.",
65-
));
63+
return Err(ErrorCode::aborting());
6664
}
6765

6866
match meta {

src/query/pipeline/transforms/src/processors/transforms/transform_sort_merge.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ impl<R: Rows> MergeSort<R> for TransformSortMerge<R> {
8282

8383
fn add_block(&mut self, block: DataBlock, init_rows: R) -> Result<()> {
8484
if unlikely(self.aborting.load(Ordering::Relaxed)) {
85-
return Err(ErrorCode::AbortedQuery(
86-
"Aborted query, because the server is shutting down or the query was killed.",
87-
));
85+
return Err(ErrorCode::aborting());
8886
}
8987

9088
if unlikely(block.is_empty()) {
@@ -177,9 +175,7 @@ impl<R: Rows> TransformSortMerge<R> {
177175

178176
while let Some(block) = merger.next_block()? {
179177
if unlikely(self.aborting.load(Ordering::Relaxed)) {
180-
return Err(ErrorCode::AbortedQuery(
181-
"Aborted query, because the server is shutting down or the query was killed.",
182-
));
178+
return Err(ErrorCode::aborting());
183179
}
184180
result.push(block);
185181
}

src/query/service/src/interpreters/interpreter_kill.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ impl KillInterpreter {
110110
}
111111
}
112112

113-
kill_session.force_kill_query(ErrorCode::AbortedQuery(
114-
"Aborted query, because the server is shutting down or the query was killed",
115-
));
113+
kill_session.force_kill_query(ErrorCode::aborting());
116114
Ok(PipelineBuildResult::create())
117115
}
118116
}

src/query/service/src/pipelines/processors/transforms/hash_join/hash_join_build_state.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,7 @@ impl HashJoinBuildState {
516516
}
517517

518518
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
519-
return Err(ErrorCode::AbortedQuery(
520-
"Aborted query, because the server is shutting down or the query was killed.",
521-
));
519+
return Err(ErrorCode::aborting());
522520
}
523521

524522
let chunk_index = task;

src/query/service/src/pipelines/processors/transforms/hash_join/hash_join_probe_state.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,7 @@ impl HashJoinProbeState {
454454
probe_state: &mut ProbeState,
455455
) -> Result<Vec<DataBlock>> {
456456
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
457-
return Err(ErrorCode::AbortedQuery(
458-
"Aborted query, because the server is shutting down or the query was killed.",
459-
));
457+
return Err(ErrorCode::aborting());
460458
}
461459

462460
// Probe states.

src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/inner_join.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,7 @@ impl HashJoinProbeState {
178178
let mut filtered_blocks = Vec::with_capacity(result_blocks.len());
179179
for result_block in result_blocks {
180180
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
181-
return Err(ErrorCode::AbortedQuery(
182-
"Aborted query, because the server is shutting down or the query was killed.",
183-
));
181+
return Err(ErrorCode::aborting());
184182
}
185183
let result_block = filter_executor.filter(result_block)?;
186184
if !result_block.is_empty() {
@@ -205,9 +203,7 @@ impl HashJoinProbeState {
205203
right_single_scan_map: &mut [*mut AtomicBool],
206204
) -> Result<DataBlock> {
207205
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
208-
return Err(ErrorCode::AbortedQuery(
209-
"Aborted query, because the server is shutting down or the query was killed.",
210-
));
206+
return Err(ErrorCode::aborting());
211207
}
212208

213209
let probe_block = if probe_state.is_probe_projected {

src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/left_anti_join.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ impl HashJoinProbeState {
7474
};
7575

7676
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
77-
return Err(ErrorCode::AbortedQuery(
78-
"Aborted query, because the server is shutting down or the query was killed.",
79-
));
77+
return Err(ErrorCode::aborting());
8078
}
8179

8280
let result_block = DataBlock::take(&process_state.input, &probe_indexes[0..count])?;
@@ -255,9 +253,7 @@ impl HashJoinProbeState {
255253
filter_executor: &mut FilterExecutor,
256254
) -> Result<()> {
257255
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
258-
return Err(ErrorCode::AbortedQuery(
259-
"Aborted query, because the server is shutting down or the query was killed.",
260-
));
256+
return Err(ErrorCode::aborting());
261257
}
262258

263259
let probe_block = if probe_state.is_probe_projected {

src/query/service/src/pipelines/processors/transforms/hash_join/probe_join/left_join.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ impl HashJoinProbeState {
365365
build_state: &BuildBlockGenerationState,
366366
) -> Result<DataBlock> {
367367
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
368-
return Err(ErrorCode::AbortedQuery(
369-
"Aborted query, because the server is shutting down or the query was killed.",
370-
));
368+
return Err(ErrorCode::aborting());
371369
}
372370

373371
let probe_block = if probe_state.is_probe_projected {
@@ -415,9 +413,7 @@ impl HashJoinProbeState {
415413
row_state_indexes: Option<&mut Vec<usize>>,
416414
) -> Result<()> {
417415
if self.hash_join_state.interrupt.load(Ordering::Relaxed) {
418-
return Err(ErrorCode::AbortedQuery(
419-
"Aborted query, because the server is shutting down or the query was killed.",
420-
));
416+
return Err(ErrorCode::aborting());
421417
}
422418

423419
let probe_block = if probe_state.is_probe_projected {

0 commit comments

Comments
 (0)