提交 efbc6186 编写于 作者: S Shreedhar Hardikar

Explicitly initialize GPOPT and its dependencies.

These were initialized by constructors earlier. To pass any parameters
for initializing GPOPT or any of its dependendencies, we need to do that
explicitly.
上级 8eedfe9f
......@@ -22,8 +22,8 @@
</configurations>
<dependencies>
<dependency org="emc" name="optimizer" rev="1.630" conf="osx106_x86->osx106_x86_32;rhel5_x86_64->rhel5_x86_64;suse10_x86_64->suse10_x86_64;suse11_x86_64->suse10_x86_64" />
<dependency org="emc" name="libgpos" rev="1.136" conf="osx106_x86->osx106_x86_32;rhel5_x86_64->rhel5_x86_64;suse10_x86_64->suse10_x86_64;suse11_x86_64->suse10_x86_64" />
<dependency org="emc" name="optimizer" rev="1.633" conf="osx106_x86->osx106_x86_32;rhel5_x86_64->rhel5_x86_64;suse10_x86_64->suse10_x86_64;suse11_x86_64->suse10_x86_64" />
<dependency org="emc" name="libgpos" rev="1.137" conf="osx106_x86->osx106_x86_32;rhel5_x86_64->rhel5_x86_64;suse10_x86_64->suse10_x86_64;suse11_x86_64->suse10_x86_64" />
<dependency org="xerces" name="xerces-c" rev="3.1.1-p1" conf="osx106_x86->osx106_x86_32;rhel5_x86_64->rhel5_x86_64;suse10_x86_64->suse10_x86_64;suse11_x86_64->suse10_x86_64" />
<dependency org="OpenSSL" name="openssl" rev="0.9.8zg" conf="osx106_x86->osx105_x86;aix5_ppc_32->aix5_ppc_32;aix5_ppc_64->aix5_ppc_64;hpux_ia64->hpux_ia64;rhel5_x86_32->rhel5_x86_32;rhel5_x86_64->rhel5_x86_64;rhel6_x86_64->rhel6_x86_64;sol10_x86_32->sol10_x86_32;sol10_x86_64->sol10_x86_64;sol10_sparc_32->sol10_sparc_32;sol10_sparc_64->sol10_sparc_64;suse10_x86_64->suse10_x86_64;suse11_x86_64->suse11_x86_64" />
<dependency org="emc" name="DDBoostSDK" rev="3.0.0.3-446710" conf="rhel5_x86_64->rhel5_x86_64" />
......
......@@ -32,7 +32,7 @@
void
CGPOptimizer::TouchLibraryInitializers()
{
void (*gpos)() = gpos_init;
void (*gpos)(gpos_init_params*) = gpos_init;
void (*dxl)() = gpdxl_init;
void (*opt)() = gpopt_init;
}
......@@ -74,6 +74,39 @@ CGPOptimizer::SzDXLPlan
return COptTasks::SzOptimize(pquery);
}
//---------------------------------------------------------------------------
// @function:
// InitGPOPT()
//
// @doc:
// Initialize GPTOPT and dependent libraries
//
//---------------------------------------------------------------------------
void
CGPOptimizer::InitGPOPT ()
{
// Use GPORCA's default allocators
struct gpos_init_params params = { NULL, NULL };
gpos_init(&params);
gpdxl_init();
gpopt_init();
}
//---------------------------------------------------------------------------
// @function:
// TerminateGPOPT()
//
// @doc:
// Terminate GPOPT and dependent libraries
//
//---------------------------------------------------------------------------
void
CGPOptimizer::TerminateGPOPT ()
{
gpopt_terminate();
gpdxl_terminate();
gpos_terminate();
}
//---------------------------------------------------------------------------
// @function:
......@@ -114,4 +147,36 @@ char *SzDXLPlan
}
}
//---------------------------------------------------------------------------
// @function:
// InitGPOPT()
//
// @doc:
// Initialize GPTOPT and dependent libraries
//
//---------------------------------------------------------------------------
extern "C"
{
void InitGPOPT ()
{
return CGPOptimizer::InitGPOPT();
}
}
//---------------------------------------------------------------------------
// @function:
// TerminateGPOPT()
//
// @doc:
// Terminate GPOPT and dependent libraries
//
//---------------------------------------------------------------------------
extern "C"
{
void TerminateGPOPT ()
{
return CGPOptimizer::TerminateGPOPT();
}
}
// EOF
......@@ -70,6 +70,11 @@ static void ShutdownPostgres(int code, Datum arg);
static bool ThereIsAtLeastOneRole(void);
static void process_startup_options(Port *port, bool am_superuser);
#ifdef USE_ORCA
extern void InitGPOPT();
extern void TerminateGPOPT();
#endif
/*** InitPostgres support ***/
......@@ -587,6 +592,11 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
/* Initialize memory protection */
GPMemoryProtect_Init();
#ifdef USE_ORCA
/* Initialize GPOPT */
InitGPOPT();
#endif
/*
* Initialize my entry in the shared-invalidation manager's array of
* per-backend data.
......@@ -1077,6 +1087,10 @@ ShutdownPostgres(int code, Datum arg)
*/
ReportOOMConsumption();
#ifdef USE_ORCA
TerminateGPOPT();
#endif
/* Disable memory protection */
GPMemoryProtect_Shutdown();
/* Release SessionState entry */
......
......@@ -41,6 +41,13 @@ class CGPOptimizer
// serialize planned statement into DXL
static
char *SzDXLPlan(Query *pquery);
// gpopt initialize and terminate
static
void InitGPOPT();
static
void TerminateGPOPT();
};
#endif // CGPOptimizer_H
......@@ -45,3 +45,15 @@ OptVersion(void)
elog(ERROR, "mock implementation of OptVersion called");
return (Datum) 0;
}
void
InitGPOPT ()
{
elog(ERROR, "mock implementation of InitGPOPT called");
}
void
TerminateGPOPT ()
{
elog(ERROR, "mock implementation of TerminateGPOPT called");
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册