提交 3a586479 编写于 作者: H Haisheng Yuan

Cut down the runtime for CCostTest

Most of time is spent on running the 4 minidumps in CalibratedCostModel test.
The 4 minidumps are already tested in other test suites. Moreover, it just
executes the minidump, doesn't even compare the generaeted plan.

CalibratedCostModel is default in GPDB right now, and most minidumps use
calibrated cost model, that will also test CalibratedCostModel at the same
time. So remove EresUnittest_CalibratedCostModel. Cut down the debug runtime
of CCostTest from 814829 ms to 458 ms.
上级 2d9af1ce
......@@ -5,7 +5,7 @@ project(gpopt LANGUAGES CXX C)
set(GPORCA_VERSION_MAJOR 2)
set(GPORCA_VERSION_MINOR 39)
set(GPORCA_VERSION_PATCH 0)
set(GPORCA_VERSION_PATCH 1)
set(GPORCA_VERSION_STRING "${GPORCA_VERSION_MAJOR}.${GPORCA_VERSION_MINOR}.${GPORCA_VERSION_PATCH}")
# Whenever an ABI-breaking change is made to GPORCA, this should be incremented.
......
......@@ -42,7 +42,6 @@ namespace gpopt
static GPOS_RESULT EresUnittest_Params();
static GPOS_RESULT EresUnittest_Parsing();
static GPOS_RESULT EresUnittest_ParsingWithException();
static GPOS_RESULT EresUnittest_CalibratedCostModel();
static GPOS_RESULT EresUnittest_SetParams();
}; // class CCostTest
......
......@@ -45,9 +45,7 @@ CCostTest::EresUnittest()
GPOS_UNITTEST_FUNC(CCostTest::EresUnittest_Bool),
GPOS_UNITTEST_FUNC(CCostTest::EresUnittest_Arithmetic),
GPOS_UNITTEST_FUNC(CCostTest::EresUnittest_Params),
GPOS_UNITTEST_FUNC(CCostTest::EresUnittest_CalibratedCostModel),
GPOS_UNITTEST_FUNC(CCostTest::EresUnittest_Parsing),
GPOS_UNITTEST_FUNC(EresUnittest_SetParams),
// TODO: : re-enable test after resolving exception throwing problem on OSX
......@@ -243,16 +241,31 @@ CCostTest::EresUnittest_Params()
pmdp->AddRef();
CMDAccessor mda(pmp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp);
// install opt context in TLS
CAutoOptCtxt aoc
(
pmp,
&mda,
NULL, /* pceeval */
CTestUtils::Pcm(pmp)
);
{
// install opt context in TLS
CAutoOptCtxt aoc
(
pmp,
&mda,
NULL, /* pceeval */
CTestUtils::Pcm(pmp)
);
TestParams(pmp, false /*fCalibrated*/);
TestParams(pmp, false /*fCalibrated*/);
}
{
// install opt context in TLS
CAutoOptCtxt aoc
(
pmp,
&mda,
NULL, /* pceeval */
GPOS_NEW(pmp) CCostModelGPDB(pmp, GPOPT_TEST_SEGMENTS)
);
TestParams(pmp, true /*fCalibrated*/);
}
return GPOS_OK;
}
......@@ -305,78 +318,6 @@ CCostTest::EresUnittest_ParsingWithException()
return GPOS_OK;
}
//---------------------------------------------------------------------------
// @function:
// CCostTest::EresUnittest_CalibratedCostModel
//
// @doc:
// GPDB's calibrated cost model test
//
//---------------------------------------------------------------------------
GPOS_RESULT
CCostTest::EresUnittest_CalibratedCostModel()
{
CAutoTraceFlag atf1(EtraceSimulateOOM, false);
CAutoTraceFlag atf2(EtraceSimulateAbort, false);
CAutoTraceFlag atf3(EtraceSimulateIOError, false);
CAutoTraceFlag atf4(EtraceSimulateNetError, false);
CAutoMemoryPool amp;
IMemoryPool *pmp = amp.Pmp();
// setup a file-based provider
CMDProviderMemory *pmdp = CTestUtils::m_pmdpf;
pmdp->AddRef();
CMDAccessor mda(pmp, CMDCache::Pcache(), CTestUtils::m_sysidDefault, pmdp);
ICostModel *pcm = GPOS_NEW(pmp) CCostModelGPDB(pmp, GPOPT_TEST_SEGMENTS);
pcm->AddRef();
{
// install opt context in TLS
CAutoOptCtxt aoc
(
pmp,
&mda,
NULL, /* pceeval */
pcm
);
TestParams(pmp, true /*fCalibrated*/);
}
// minidump files
const CHAR *rgszFileNamesCalibratedCostModel[] =
{
"../data/dxl/minidump/PartTbl-MultiWayJoinWithDPE.mdp",
"../data/dxl/tpch/q2.mdp",
"../data/dxl/minidump/CTE-4.mdp",
"../data/dxl/minidump/Lead-Lag-WinFuncs.mdp",
};
COptimizerConfig* poconf = COptimizerConfig::PoconfDefault(pmp, pcm);
for (ULONG ul = 0; ul < GPOS_ARRAY_SIZE(rgszFileNamesCalibratedCostModel); ul++)
{
CDXLNode *pdxlnPlan = CMinidumperUtils::PdxlnExecuteMinidump
(
pmp,
rgszFileNamesCalibratedCostModel[ul],
GPOPT_TEST_SEGMENTS,
1 /*ulSessionId*/,
1 /*ulCmdId*/,
poconf,
NULL /*pceeval*/
);
pdxlnPlan->Release();
}
poconf->Release();
return GPOS_OK;
}
//---------------------------------------------------------------------------
// @function:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册