enhance: add detailed stack for error message (#40883)

fix #40882
adding stacktrace will operator execute failed.

Signed-off-by: xiaofanluan <xiaofan.luan@zilliz.com>
This commit is contained in:
Xiaofan 2025-03-26 13:24:20 +08:00 committed by GitHub
parent e7050a9cef
commit 8788e591cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 17 deletions

View File

@ -74,6 +74,7 @@ enum ErrorCode {
KnowhereError = 2099
};
namespace impl {
void
EasyAssertInfo(bool value,
@ -83,6 +84,9 @@ EasyAssertInfo(bool value,
std::string_view extra_info,
ErrorCode error_code = ErrorCode::UnexpectedError);
std::string
EasyStackTrace();
} // namespace impl
class SegcoreError : public std::runtime_error {

View File

@ -31,8 +31,6 @@
#include "exec/operator/GroupByNode.h"
#include "exec/Task.h"
#include "common/EasyAssert.h"
namespace milvus {
namespace exec {
@ -181,24 +179,18 @@ Driver::Next(std::shared_ptr<BlockingState>& blocking_state) {
#define CALL_OPERATOR(call_func, operator, method_name) \
try { \
call_func; \
} catch (SegcoreError & e) { \
} catch (std::exception & e) { \
std::string stack_trace = milvus::impl::EasyStackTrace(); \
auto err_msg = fmt::format( \
"Operator::{} failed for [Operator:{}, plan node id: " \
"{}] : {}", \
"{}] : {}\nStack trace: {}", \
method_name, \
operator->get_operator_type(), \
operator->ToString() , \
operator->get_plannode_id(), \
e.what()); \
e.what(), \
stack_trace); \
LOG_ERROR(err_msg); \
throw ExecOperatorException(err_msg); \
} catch (std::exception & e) { \
throw ExecOperatorException( \
fmt::format("Operator::{} failed for [Operator:{}, plan node id: " \
"{}] : {}", \
method_name, \
operator->get_operator_type(), \
operator->get_plannode_id(), \
e.what())); \
}
StopReason

View File

@ -77,13 +77,11 @@ func (s *ExcludedSegments) CleanInvalid(ts uint64) {
for _, segmentID := range invalidExcludedInfos {
delete(s.segments, segmentID)
log.Info("remove segment from exclude info", zap.Int64("segmentID", segmentID))
log.Ctx(context.TODO()).Info("remove segment from exclude info", zap.Int64("segmentID", segmentID))
}
s.lastClean.Store(time.Now())
}
func (s *ExcludedSegments) ShouldClean() bool {
s.mu.RLock()
defer s.mu.RUnlock()
return time.Since(s.lastClean.Load()) > s.cleanInterval
}