-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Enhancement] Support audic statistics for insert statement (backport #…
…29901) (#30175) * [Enhancement] Support audic statistics for insert statement (#29901) --------- Signed-off-by: liuyehcf <1559500551@qq.com> (cherry picked from commit 728573e) # Conflicts: # be/src/exec/pipeline/olap_table_sink_operator.cpp # be/src/exec/pipeline/pipeline_driver_executor.cpp # be/src/exec/pipeline/pipeline_driver_executor.h # be/src/exec/pipeline/sink/iceberg_table_sink_operator.cpp # fe/fe-core/src/main/java/com/starrocks/qe/DefaultCoordinator.java # fe/fe-core/src/main/java/com/starrocks/qe/scheduler/Coordinator.java # fe/fe-core/src/main/java/com/starrocks/service/FrontendServiceImpl.java * solve conflict Signed-off-by: liuyehcf <1559500551@qq.com> --------- Signed-off-by: liuyehcf <1559500551@qq.com> Co-authored-by: liuyehcf <1559500551@qq.com>
- Loading branch information
1 parent
87c99dd
commit 5419c90
Showing
21 changed files
with
290 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// Copyright 2021-present StarRocks, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "exec/pipeline/audit_statistics_reporter.h" | ||
|
||
#include <thrift/Thrift.h> | ||
#include <thrift/protocol/TDebugProtocol.h> | ||
|
||
#include "agent/master_info.h" | ||
#include "gen_cpp/FrontendService_types.h" | ||
#include "runtime/client_cache.h" | ||
#include "runtime/exec_env.h" | ||
#include "service/backend_options.h" | ||
|
||
namespace starrocks::pipeline { | ||
|
||
using apache::thrift::TException; | ||
using apache::thrift::TProcessor; | ||
using apache::thrift::transport::TTransportException; | ||
|
||
// including the final status when execution finishes. | ||
Status AuditStatisticsReporter::report_audit_statistics(const TReportAuditStatisticsParams& params, ExecEnv* exec_env, | ||
const TNetworkAddress& fe_addr) { | ||
Status fe_status; | ||
FrontendServiceConnection coord(exec_env->frontend_client_cache(), fe_addr, &fe_status); | ||
if (!fe_status.ok()) { | ||
LOG(WARNING) << "Couldn't get a client for " << fe_addr; | ||
return fe_status; | ||
} | ||
|
||
TReportAuditStatisticsResult res; | ||
Status rpc_status; | ||
|
||
try { | ||
try { | ||
coord->reportAuditStatistics(res, params); | ||
} catch (TTransportException& e) { | ||
TTransportException::TTransportExceptionType type = e.getType(); | ||
if (type != TTransportException::TTransportExceptionType::TIMED_OUT) { | ||
// if not TIMED_OUT, retry | ||
rpc_status = coord.reopen(); | ||
|
||
if (!rpc_status.ok()) { | ||
return rpc_status; | ||
} | ||
coord->reportAuditStatistics(res, params); | ||
} else { | ||
std::stringstream msg; | ||
msg << "ReportExecStatus() to " << fe_addr << " failed:\n" << e.what(); | ||
LOG(WARNING) << msg.str(); | ||
rpc_status = Status::InternalError(msg.str()); | ||
return rpc_status; | ||
} | ||
} | ||
|
||
rpc_status = Status(res.status); | ||
} catch (TException& e) { | ||
std::stringstream msg; | ||
msg << "ReportExecStatus() to " << fe_addr << " failed:\n" << e.what(); | ||
LOG(WARNING) << msg.str(); | ||
rpc_status = Status::InternalError(msg.str()); | ||
return rpc_status; | ||
} | ||
return rpc_status; | ||
} | ||
} // namespace starrocks::pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2021-present StarRocks, Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "exec/pipeline/fragment_context.h" | ||
#include "exec/pipeline/pipeline_fwd.h" | ||
#include "gen_cpp/FrontendService.h" | ||
#include "gen_cpp/InternalService_types.h" | ||
#include "gen_cpp/Types_types.h" | ||
#include "runtime/exec_env.h" | ||
#include "runtime/runtime_state.h" | ||
#include "service/backend_options.h" | ||
#include "util/threadpool.h" | ||
|
||
namespace starrocks::pipeline { | ||
class AuditStatisticsReporter { | ||
public: | ||
AuditStatisticsReporter(); | ||
|
||
static Status report_audit_statistics(const TReportAuditStatisticsParams& params, ExecEnv* exec_env, | ||
const TNetworkAddress& fe_addr); | ||
}; | ||
} // namespace starrocks::pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,6 @@ Returns a DOUBLE value. | |
|
||
## Examples | ||
|
||
<<<<<<< HEAD | ||
Sample dataset | ||
|
||
```plain | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.