Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] Fix BE crash when schema scan rpc failed (backport #51889) #51909

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion be/src/exec/pipeline/scan/scan_operator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,11 @@ Status ScanOperator::_trigger_next_scan(RuntimeState* state, int chunk_source_in
<< print_id(state->fragment_instance_id()) << ", error=" << start_status.to_string();
_set_scan_status(start_status);
}
Status status;

auto status = chunk_source->buffer_next_batch_chunks_blocking(state, kIOTaskBatchSize, _workgroup.get());
if (start_status.ok()) {
status = chunk_source->buffer_next_batch_chunks_blocking(state, kIOTaskBatchSize, _workgroup.get());
}

if (!status.ok() && !status.is_end_of_file()) {
LOG(ERROR) << "scan fragment " << print_id(state->fragment_instance_id()) << " driver "
Expand Down
3 changes: 3 additions & 0 deletions be/src/exec/schema_scanner/schema_variables_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
#include "runtime/runtime_state.h"
#include "runtime/string_value.h"
#include "types/logical_type.h"
#include "util/failpoint/fail_point.h"

namespace starrocks {
DEFINE_FAIL_POINT(schema_scan_rpc_failed);

SchemaScanner::ColumnDesc SchemaVariablesScanner::_s_vars_columns[] = {
// name, type, size
Expand Down Expand Up @@ -57,6 +59,7 @@ Status SchemaVariablesScanner::start(RuntimeState* state) {
var_params.__set_threadId(_param->thread_id);

// init schema scanner state
FAIL_POINT_TRIGGER_RETURN_ERROR(schema_scan_rpc_failed);
RETURN_IF_ERROR(SchemaScanner::init_schema_scanner_state(state));
RETURN_IF_ERROR(SchemaHelper::show_variables(_ss_state, var_params, &_var_result));

Expand Down
10 changes: 10 additions & 0 deletions test/sql/test_scan/R/test_schema_scan_rpc_failed
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- name: test_schema_scan_rpc_failed
admin enable failpoint 'schema_scan_rpc_failed';
-- result:
-- !result
[UC] SHOW VARIABLES WHERE Variable_name ='language';
-- result:
-- !result
admin disable failpoint 'schema_scan_rpc_failed';
-- result:
-- !result
5 changes: 5 additions & 0 deletions test/sql/test_scan/T/test_schema_scan_rpc_failed
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- name: test_schema_scan_rpc_failed

admin enable failpoint 'schema_scan_rpc_failed';
[UC] SHOW VARIABLES WHERE Variable_name ='language';
admin disable failpoint 'schema_scan_rpc_failed';
Loading