コード例 #1
0
ファイル: Backend.c プロジェクト: greenplum-db/pljava
void _PG_init()
{
	if ( IS_PLJAVA_FOUND == initstage )
		return; /* creating handler functions will cause recursive call */
	pljavaCheckExtension( NULL);
	initsequencer( initstage, true);
}
コード例 #2
0
ファイル: Backend.c プロジェクト: TwentyOneSolutions/pljava
ASSIGNHOOK(enabled, bool)
{
	ASSIGNRETURNIFCHECK(true);
	pljavaEnabled = newval;
	if ( IS_FORMLESS_VOID < initstage && initstage < IS_PLJAVA_ENABLED )
	{
		alteredSettingsWereNeeded = true;
		ASSIGNRETURNIFNXACT(true);
		initsequencer( initstage, true);
	}
	ASSIGNRETURN(true);
}
コード例 #3
0
ファイル: Backend.c プロジェクト: TwentyOneSolutions/pljava
static Datum internalCallHandler(bool trusted, PG_FUNCTION_ARGS)
{
	Invocation ctx;
	Datum retval = 0;

	if ( IS_COMPLETE != initstage )
	{
		/*
		 * Just in case it could be helpful in offering diagnostics later, hang
		 * on to an Oid that is known to refer to PL/Java (because it got here).
		 * It's cheap, and can be followed back to the right language and
		 * handler function entries later if needed.
		 */
		*(trusted ? &pljavaTrustedOid : &pljavaUntrustedOid)
			= fcinfo->flinfo->fn_oid;
		initsequencer( initstage, false);

		/* Force initial setting
 		 */
		s_currentTrust = !trusted;
	}

	Invocation_pushInvocation(&ctx, trusted);
	PG_TRY();
	{
		Function function = Function_getFunction(fcinfo);
		if(CALLED_AS_TRIGGER(fcinfo))
		{
			/* Called as a trigger procedure
			 */
			retval = Function_invokeTrigger(function, fcinfo);
		}
		else
		{
			/* Called as a function
			 */
			retval = Function_invoke(function, fcinfo);
		}
		Invocation_popInvocation(false);
	}
	PG_CATCH();
	{
		Invocation_popInvocation(true);
		PG_RE_THROW();
	}
	PG_END_TRY();
	return retval;
}
コード例 #4
0
ファイル: Backend.c プロジェクト: greenplum-db/pljava
static Datum internalCallHandler(bool trusted, PG_FUNCTION_ARGS)
{
	Invocation ctx;
	Datum retval = 0;

#ifdef USE_PLJAVA_SIGHANDLERS
	/*
	 * Substitute SIGUSR1 handler CatchupInterruptHandler with new local
	 * handler PLCatchupInterruptHandler, which will strictly let main
	 * thread of GPDB to process the signal rather than any other threads.
	 *
	 * Resolving possible lwlock releasing crash caused by SIGUSR1.
	 * MPP-23735
	 */
	if(!s_handlerSubstituted)
	{
		s_mainThreadIdForHandler = pthread_self();
		s_oldHandlerFunc = pqsignal(SIGUSR1, PLCatchupInterruptHandler);
		s_handlerSubstituted = true;
	}
#endif

	/*
	 * Just in case it could be helpful in offering diagnostics later, hang
	 * on to an Oid that is known to refer to PL/Java (because it got here).
	 * It's cheap, and can be followed back to the right language and
	 * handler function entries later if needed.
	 */
	*(trusted ? &pljavaTrustedOid : &pljavaUntrustedOid)
		= fcinfo->flinfo->fn_oid;
	if ( IS_COMPLETE != initstage )
	{
		initsequencer( initstage, false);

		/* Force initial setting
 		 */
		s_currentTrust = !trusted;
	}

	Invocation_pushInvocation(&ctx, trusted);
	PG_TRY();
	{
		Function function = Function_getFunction(fcinfo);
		if(CALLED_AS_TRIGGER(fcinfo))
		{
			/* Called as a trigger procedure
			 */
			retval = Function_invokeTrigger(function, fcinfo);
		}
		else
		{
			/* Called as a function
			 */
			retval = Function_invoke(function, fcinfo);
		}
		Invocation_popInvocation(false);
	}
	PG_CATCH();
	{
		Invocation_popInvocation(true);
		PG_RE_THROW();
	}
	PG_END_TRY();
	return retval;
}