Beispiel #1
0
void CSmodule_AbstractDisplay::init()
{
	oldBodyColor = bodyColor;
	oldBodySelColor = bodySelColor;

	if (!parent) return;

	// ---- image and window ----
	img = 0;
	setImage(CSMOD_INIT_EXTWIN_WIDTH, CSMOD_INIT_EXTWIN_HEIGHT);

	server = 0;
	server1 = 0;
	requestServerChange = isServer = isClient = false;

	connectToServer("");

	wasScreenUpdate = false;

	// ---- properties ----

	createNameProperty();
	createPropertyInt("w", "buffer width", CSMOD_INIT_EXTWIN_WIDTH, 1, 4096);
	createPropertyInt("h", "buffer height", CSMOD_INIT_EXTWIN_HEIGHT, 1, 4096);
	createPropertyString("serverstr", "bitmap server name", "");
	createPropertyString("clientstr", "connect to bitmap server", "");
}
/**
 * HAWQ RM handles the resource queue definition manipulation including CREATE,
 * ALTER and DROP RESOURCE QUEUE statements.
 */
bool handleRMDDLRequestManipulateResourceQueue(void **arg)
{
	int      				res		 		= FUNC_RETURN_OK;
	uint32_t				ddlres   		= FUNC_RETURN_OK;
	ConnectionTrack        *conntrack       = (ConnectionTrack *)arg;
	DynResourceQueueTrack 	newtrack 		= NULL;
	DynResourceQueueTrack   todroptrack		= NULL;
	DynResourceQueueTrack   toupdatetrack	= NULL;
	SelfMaintainBufferData  responsebuff;
	static char 			errorbuf[1024] 	= "";
	bool					exist 			= false;
	List 				   *fineattr		= NULL;
	List 				   *rsqattr			= NULL;
	DynResourceQueue 		newqueue 		= NULL;
	DynResourceQueue        oldqueue        = NULL;

	/* Check context and retrieve the connection track based on connection id.*/
	RPCRequestHeadManipulateResQueue request = (RPCRequestHeadManipulateResQueue)
											   ((*conntrack)->MessageBuff.Buffer);

	elog(LOG, "Resource manager gets a request from ConnID %d to submit resource "
			  "queue DDL statement.",
			  request->ConnID);

	elog(DEBUG3, "With attribute list size %d", request->WithAttrLength);

	if ( (*conntrack)->ConnID == INVALID_CONNID )
	{
		res = retrieveConnectionTrack((*conntrack), request->ConnID);
		if ( res != FUNC_RETURN_OK )
		{
			elog(WARNING, "Not valid resource context with id %d.", request->ConnID);
			goto senderr;
		}

		elog(DEBUG5, "Resource manager fetched existing connection track "
					 "ID=%d, Progress=%d.",
					 (*conntrack)->ConnID,
					 (*conntrack)->Progress);
	}

	/*
	 * Only registered connection can manipulate resource queue, the status
	 * should be CONN_REGISTER_DONE.
	 */
	Assert( (*conntrack)->Progress == CONN_PP_REGISTER_DONE );

	/*
	 * Only the super user can manipulate resource queue. This is already
	 * checked before sending RPC to RM this process.
	 */
	Assert((*conntrack)->User != NULL &&
		   ((UserInfo)((*conntrack)->User))->isSuperUser);

	/* Build property list for the resource queue to be created. */
	request = (RPCRequestHeadManipulateResQueue)((*conntrack)->MessageBuff.Buffer);

	/* Get resource queue name. */
	char *string = (*conntrack)->MessageBuff.Buffer +
				   sizeof(RPCRequestHeadManipulateResQueueData);
	KVProperty nameattr = createPropertyString(PCONTEXT,
											   NULL,
											   getRSQTBLAttributeName(RSQ_TBL_ATTR_NAME),
											   NULL,
											   string);
	{
		MEMORY_CONTEXT_SWITCH_TO(PCONTEXT)
		rsqattr = lappend(rsqattr, nameattr);
		MEMORY_CONTEXT_SWITCH_BACK
	}

	string += nameattr->Val.Len+1;

	/* Get with list. <key>=<value> */
	for ( int i = 0 ; i < request->WithAttrLength ; ++i )
	{
		KVProperty withattr = createPropertyEmpty(PCONTEXT);
		setSimpleStringNoLen(&(withattr->Key), string);
		string += withattr->Key.Len + 1;
		setSimpleStringNoLen(&(withattr->Val), string);
		string += withattr->Val.Len + 1;

		MEMORY_CONTEXT_SWITCH_TO(PCONTEXT)
		rsqattr = lappend(rsqattr, withattr);
		MEMORY_CONTEXT_SWITCH_BACK
	}

	/* Log the received attributes in DDL request. */
	ListCell *cell = NULL;
	foreach(cell, rsqattr)
	{
		KVProperty attribute = lfirst(cell);
		elog(DEBUG3, "Resource manager received DDL Request: %s=%s",
				     attribute->Key.Str, attribute->Val.Str);
	}