Esempio n. 1
0
//---------------------------------------------------------------------------
//	@function:
//		CTreeMapTest::EresUnittest_FailedPlanEnumerationTests
//
//	@doc:
//		Run Minidump-based tests that fail during plan enumeration because
//		of large plan space
//
//---------------------------------------------------------------------------
GPOS_RESULT
CTreeMapTest::EresUnittest_FailedPlanEnumerationTests()
{
	CAutoMemoryPool amp;
	IMemoryPool *pmp = amp.Pmp();

	BOOL fMatchPlans = false;
	BOOL fTestSpacePruning = false;
#if defined(GPOS_Darwin) || defined(GPOS_Linux)
	// restrict plan matching to OsX and Linux to avoid arithmetic operations differences
	// across systems
	fMatchPlans = true;
	fTestSpacePruning = true;
#endif // GPOS_Darwin || GPOS_Linux

	// enable plan enumeration only if we match plans
	CAutoTraceFlag atf1(EopttraceEnumeratePlans, fMatchPlans);

	// enable stats derivation for DPE
	CAutoTraceFlag atf2(EopttraceDeriveStatsForDPE, true /*fVal*/);

	const ULONG ulTests = GPOS_ARRAY_SIZE(rgszFailedPlanEnumerationTests);
	GPOS_RESULT eres = GPOS_OK;
	for (ULONG ul = 0; eres == GPOS_OK && ul < ulTests; ul++)
	{
		GPOS_TRY
		{
			eres =
				CTestUtils::EresRunMinidumps
								(
								pmp,
								&rgszFailedPlanEnumerationTests[ul],
								1, // ulTests
								&m_ulTestCounter,
								1, // ulSessionId
								1,  // ulCmdId
								fMatchPlans,
								fTestSpacePruning
								);
		}
		GPOS_CATCH_EX(ex)
		{
			if (GPOS_MATCH_EX(ex, CException::ExmaSystem, CException::ExmiOverflow))
			{
				eres = GPOS_OK;
				GPOS_RESET_EX;
			}
			else
			{
				GPOS_RETHROW(ex);

				eres = GPOS_FAILED;
			}
		}
		GPOS_CATCH_END;
	}

	return eres;
}
Esempio n. 2
0
//---------------------------------------------------------------------------
//	@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;
}