diff --git a/src/backend/gpopt/utils/COptTasks.cpp b/src/backend/gpopt/utils/COptTasks.cpp index 240dc6dc654d7ee9c0ba7007d9d810cd50b9c1c1..0d4c949833e1a221e896de973e5aebc524329d7a 100644 --- a/src/backend/gpopt/utils/COptTasks.cpp +++ b/src/backend/gpopt/utils/COptTasks.cpp @@ -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); diff --git a/src/backend/gporca/libgpos/include/gpos/_api.h b/src/backend/gporca/libgpos/include/gpos/_api.h index c60489e4a50f72de426c4384870465e387a490f2..c89e5b21a039a927032e03bac02e6b2b95469684 100644 --- a/src/backend/gporca/libgpos/include/gpos/_api.h +++ b/src/backend/gporca/libgpos/include/gpos/_api.h @@ -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); diff --git a/src/backend/gporca/libgpos/src/_api.cpp b/src/backend/gporca/libgpos/src/_api.cpp index 1c0d5681f9f577c0e2c76cc955fdc49f397afc02..5e1ed98c49efa6d54a961b76644c9dd9d864c863 100644 --- a/src/backend/gporca/libgpos/src/_api.cpp +++ b/src/backend/gporca/libgpos/src/_api.cpp @@ -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 (...) diff --git a/src/backend/optimizer/plan/orca.c b/src/backend/optimizer/plan/orca.c index 93e54ee42792d1e7b1485772a590b628f7d31359..d119f6c5e9df9fa23816e996ea11c29a976c2597 100644 --- a/src/backend/optimizer/plan/orca.c +++ b/src/backend/optimizer/plan/orca.c @@ -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; } }