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

refine error message in mpptask #5304

Merged
merged 11 commits into from
Jul 7, 2022
2 changes: 1 addition & 1 deletion dbms/src/Flash/EstablishCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void EstablishCallData::finishTunnelAndResponder()
state = FINISH;
if (mpp_tunnel)
{
mpp_tunnel->consumerFinish("grpc writes failed.", true); //trigger mpp tunnel finish work
mpp_tunnel->consumerFinish(fmt::format("{}: finishTunnelAndResponder called.", mpp_tunnel->id()), true); //trigger mpp tunnel finish work
}
grpc::Status status(static_cast<grpc::StatusCode>(GRPC_STATUS_UNKNOWN), "Consumer exits unexpected, grpc writes failed.");
responder.Finish(status, this);
Expand Down
4 changes: 3 additions & 1 deletion dbms/src/Flash/Mpp/MPPTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void MPPTask::runImpl()
}
catch (...)
{
err_msg = getCurrentExceptionMessage(true);
err_msg = getCurrentExceptionMessage(true, true);
}

if (err_msg.empty())
Expand All @@ -405,6 +405,8 @@ void MPPTask::runImpl()
if (status == RUNNING)
{
LOG_FMT_ERROR(log, "task running meets error: {}", err_msg);
/// trim the stack trace to avoid too many useless information in log
trimStackTrace(err_msg);
try
{
handleError(err_msg);
Expand Down
4 changes: 4 additions & 0 deletions dbms/src/Flash/Mpp/MPPTunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ void MPPTunnelBase<Writer>::sendJob(bool need_lock)
err_msg = "fatal error in sendJob()";
}
if (!err_msg.empty())
{
/// append tunnel id to error message
err_msg = fmt::format("{} meet error: {}", tunnel_id, err_msg);
LOG_ERROR(log, err_msg);
}
consumerFinish(err_msg, need_lock);
if (is_async)
writer->writeDone(grpc::Status::OK);
Expand Down
11 changes: 11 additions & 0 deletions dbms/src/Flash/Mpp/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include <Flash/Mpp/Utils.h>
#include <Poco/String.h>

#include <memory>

Expand All @@ -27,4 +28,14 @@ mpp::MPPDataPacket getPacketWithError(String reason)
return data;
}

void trimStackTrace(String & message)
{
auto stack_trace_pos = message.find("Stack trace");
if (stack_trace_pos != String::npos)
{
message.resize(stack_trace_pos);
Poco::trimRightInPlace(message);
}
}

} // namespace DB
1 change: 1 addition & 0 deletions dbms/src/Flash/Mpp/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
namespace DB
{
mpp::MPPDataPacket getPacketWithError(String reason);
void trimStackTrace(String & message);

} // namespace DB