未验证 提交 fba77702 编写于 作者: S Sambitesh Dash 提交者: GitHub

Log fewer errors (#10100)

This is a continuation of commit 456b2b31 in GPORCA. Adding more errors to the list that
doesn't get logged in log file. We are also removing the code that writes to std::cerr,
generating a not very nice looking log message. Instead, add the info whether the error was
unexpected to another log message that we also generate.
上级 ff738f09
......@@ -693,7 +693,7 @@ COptTasks::OptimizeTask
IErrorContext *errctxt = CTask::Self()->GetErrCtxt();
opt_ctxt->m_should_error_out = ShouldErrorOut(ex);
opt_ctxt->m_is_unexpected_failure = IsUnexpectedFailure(ex);
opt_ctxt->m_is_unexpected_failure = IsLoggableFailure(ex);
opt_ctxt->m_error_msg = CreateMultiByteCharStringFromWCString(errctxt->GetErrorMsg());
GPOS_RETHROW(ex);
......
......@@ -29,7 +29,7 @@ gpos::BOOL FoundException(gpos::CException &exc, const gpos::ULONG *exceptions,
// Check if given exception is an unexpected reason for failing to
// produce a plan
gpos::BOOL IsUnexpectedFailure(gpos::CException &exc);
gpos::BOOL IsLoggableFailure(gpos::CException &exc);
// check if given exception should error out
gpos::BOOL ShouldErrorOut(gpos::CException &exc);
......
......@@ -30,22 +30,42 @@
using namespace gpos;
// refer gpopt/exception.cpp for explanation of errors
const ULONG expected_opt_fallback[] =
{
gpopt::ExmiInvalidPlanAlternative, // chosen plan id is outside range of possible plans
gpopt::ExmiUnsupportedOp, // unsupported operator
gpopt::ExmiUnsupportedPred, // unsupported predicate
gpopt::ExmiUnsupportedCompositePartKey, // composite partitioning keys
gpopt::ExmiUnsupportedNonDeterministicUpdate // non deterministic update
gpopt::ExmiUnsupportedNonDeterministicUpdate, // non deterministic update
gpopt::ExmiNoPlanFound,
gpopt::ExmiUnsupportedOp,
gpopt::ExmiUnexpectedOp,
gpopt::ExmiUnsatisfiedRequiredProperties,
gpopt::ExmiEvalUnsupportedScalarExpr,
gpopt::ExmiCTEProducerConsumerMisAligned
};
// array of DXL minor exception types that trigger expected fallback to the planner
// refer naucrates/exception.cpp for explanation of errors
const ULONG expected_dxl_fallback[] =
{
gpdxl::ExmiMDObjUnsupported, // unsupported metadata object
gpdxl::ExmiQuery2DXLUnsupportedFeature, // unsupported feature during algebrization
gpdxl::ExmiPlStmt2DXLConversion, // unsupported feature during plan freezing
gpdxl::ExmiDXL2PlStmtConversion // unsupported feature during planned statement translation
gpdxl::ExmiDXL2PlStmtConversion, // unsupported feature during planned statement translation
gpdxl::ExmiDXL2ExprAttributeNotFound,
gpdxl::ExmiOptimizerError,
gpdxl::ExmiDXLMissingAttribute,
gpdxl::ExmiDXLUnrecognizedOperator,
gpdxl::ExmiDXLUnrecognizedCompOperator,
gpdxl::ExmiDXLIncorrectNumberOfChildren,
gpdxl::ExmiQuery2DXLMissingValue,
gpdxl::ExmiQuery2DXLDuplicateRTE,
gpdxl::ExmiMDCacheEntryNotFound,
gpdxl::ExmiQuery2DXLError,
gpdxl::ExmiInvalidComparisonTypeCode
};
// array of DXL minor exception types that error out and NOT fallback to the planner
......@@ -86,7 +106,7 @@ FoundException
return found;
}
gpos::BOOL IsUnexpectedFailure
gpos::BOOL IsLoggableFailure
(
gpos::CException &exc
)
......@@ -249,17 +269,6 @@ int gpos_exec
}
catch(CException ex)
{
if (IsUnexpectedFailure(ex))
{
std::cerr
<< "Unexpected exception reached top of execution stack:"
<< " major=" << ex.Major()
<< " minor=" << ex.Minor()
<< " file=" << ex.Filename()
<< " line=" << ex.Line()
<< std::endl;
// unexpected failure
}
throw ex;
}
catch (...)
......
......@@ -63,7 +63,14 @@ log_optimizer(PlannedStmt *plan, bool fUnexpectedFailure)
(fUnexpectedFailure && OPTIMIZER_UNEXPECTED_FAIL == optimizer_log_failure) || /* unexpected fall back */
(!fUnexpectedFailure && OPTIMIZER_EXPECTED_FAIL == optimizer_log_failure)) /* expected fall back */
{
elog(LOG, "Pivotal Optimizer (GPORCA) failed to produce plan");
if (fUnexpectedFailure)
{
elog(LOG, "Pivotal Optimizer (GPORCA) failed to produce plan (unexpected)");
}
else
{
elog(LOG, "Pivotal Optimizer (GPORCA) failed to produce plan");
}
return;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册