当前位置: 首页>>代码示例>>C++>>正文


C++ pool_debug函数代码示例

本文整理汇总了C++中pool_debug函数的典型用法代码示例。如果您正苦于以下问题:C++ pool_debug函数的具体用法?C++ pool_debug怎么用?C++ pool_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pool_debug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pool_add_sent_message

/*
 * Add a sent message to sent message list
 */
void pool_add_sent_message(POOL_SENT_MESSAGE *message)
{
	POOL_SENT_MESSAGE *old_msg;
	POOL_SENT_MESSAGE_LIST *msglist;

	if (!session_context)
	{
		pool_error("pool_add_sent_message: session context is not initialized");
		return;
	}

	if (!message)
	{
		pool_debug("pool_add_sent_message: message is NULL");
		return;
	}

	old_msg = pool_get_sent_message(message->kind, message->name);
	msglist = &session_context->message_list;

	if (old_msg)
	{
		if (message->kind == 'B')
			pool_debug("pool_add_sent_message: portal \"%s\" already exists",
					   message->name);
		else
			pool_debug("pool_add_sent_message: prepared statement \"%s\" already exists",
					   message->name);

		if (*message->name == '\0')
			pool_remove_sent_message(old_msg->kind, old_msg->name);
		else
			return;
	}

	if (msglist->size == msglist->capacity)
	{
		msglist->capacity *= 2;
		msglist->sent_messages = realloc(msglist->sent_messages,
										 sizeof(POOL_SENT_MESSAGE *) * msglist->capacity);
		if (!msglist->sent_messages)
		{
			pool_error("pool_add_sent_message: realloc failed: %s", strerror(errno));
			exit(1);
		}
	}

	msglist->sent_messages[msglist->size++] = message;
}
开发者ID:aerfaman,项目名称:pgpool2,代码行数:52,代码来源:pool_session_context.c

示例2: function_call_walker

/*
 * Walker function to find a function call which is supposed to write
 * database.
 */
static bool function_call_walker(Node *node, void *context)
{
	SelectContext	*ctx = (SelectContext *) context;

	if (node == NULL)
		return false;

	if (IsA(node, FuncCall))
	{
		FuncCall *fcall = (FuncCall *)node;
		char *fname;
		int length = list_length(fcall->funcname);

		if (length > 0)
		{
			if (length == 1)	/* no schema qualification? */
			{
				fname = strVal(linitial(fcall->funcname));
			}
			else
			{
				fname = strVal(lsecond(fcall->funcname));		/* with schema qualification */
			}

			pool_debug("function_call_walker: function name: %s", fname);

			/*
			 * Check white list if any.
			 */
			if (pool_config->num_white_function_list > 0)
			{
				/* Search function in the white list regex patterns */
				if (pattern_compare(fname, WHITELIST, "white_function_list") == 1) {
					/* If the function is found in the white list, we can ignore it */
					return raw_expression_tree_walker(node, function_call_walker, context);
				}
				/*
				 * Since the function was not found in white list, we
				 * have found a writing function.
				 */
				ctx->has_function_call = true;
				return false;
			}

			/*
			 * Check black list if any.
			 */
			if (pool_config->num_black_function_list > 0)
			{
				/* Search function in the black list regex patterns */
				if (pattern_compare(fname, BLACKLIST, "black_function_list") == 1) {
					/* Found. */
					ctx->has_function_call = true;
					return false;
				}
			}
		}
	}
	return raw_expression_tree_walker(node, function_call_walker, context);
}
开发者ID:ZheYuan,项目名称:prestogres,代码行数:64,代码来源:pool_select_walker.c

示例3: pool_session_remove_all_cursors

void pool_session_remove_all_cursors()
{
	if(session_context == NULL) return;
	pool_debug("Removing all cursors");

	memset(&session_context->opened_cursors, 0, sizeof(session_context->opened_cursors));
}
开发者ID:afedonin,项目名称:repo-test,代码行数:7,代码来源:pool_session_context.c

示例4: wd_hb_recv

int
wd_hb_recv(int sock, WdHbPacket * pkt)
{
	int rtn;
	struct sockaddr_in senderinfo;
	socklen_t addrlen;
	WdHbPacket buf;

	addrlen = sizeof(senderinfo);

	rtn = recvfrom(sock, &buf, sizeof(WdHbPacket), 0,
	               (struct sockaddr *)&senderinfo, &addrlen);
	if (rtn < 0)
	{	
		pool_error("wd_hb_recv: failed to receive packet");
		return WD_NG;
	}
	else if (rtn == 0)
	{
		pool_error("wd_hb_recv: received zero bytes");
		return WD_NG;
	}
	else
	{
		pool_debug("wd_hb_recv: received %d byte packet", rtn);
	}

	ntoh_wd_hb_packet(pkt, &buf);

	return WD_OK;
}
开发者ID:codeforall,项目名称:pgpool2_newtree,代码行数:31,代码来源:wd_heartbeat.c

示例5: write_cache

/* --------------------------------
 * write_cache() - append result data to buffer
 *
 * returns 0 on success, -1 otherwise
 * --------------------------------
 */
static int
write_cache(void *buf, int len)
{
	int required_len;

	if (len < 0)
		return -1;

	required_len = query_cache_info->cache_offset + len;
	if (required_len > query_cache_info->cache_size)
	{
		char *ptr;

		required_len = query_cache_info->cache_size * 2;
		ptr = (char *)realloc(query_cache_info->cache, required_len);
		if (malloc_failed(ptr))
			return -1;

		query_cache_info->cache = ptr;
		query_cache_info->cache_size = required_len;

		pool_debug("pool_query_cache: extended cache buffer size to %d", query_cache_info->cache_size);
	}

	memcpy(query_cache_info->cache + query_cache_info->cache_offset, buf, len);
	query_cache_info->cache_offset += len;

	return 0;
}
开发者ID:mfyang,项目名称:pgpool-II,代码行数:35,代码来源:pool_query_cache.c

示例6: ForwardCacheToFrontend

/* --------------------------------
 * ForwardCacheToFrontend - simply forwards cached data to the frontend
 *
 * since the cached data passed from the caller is in escaped binary string
 * format, unescape it and send it to the frontend appending 'Z' at the end.
 * returns 0 on success, -1 otherwise.
 * --------------------------------
 */
static int ForwardCacheToFrontend(POOL_CONNECTION *frontend, char *cache, char tstate)
{
	int sendlen;
	size_t sz;
	char *binary_cache = NULL;

	binary_cache = (char *)PQunescapeBytea((unsigned char *)cache, &sz);
	sendlen = (int) sz;
	if (malloc_failed(binary_cache))
		return -1;

	pool_debug("ForwardCacheToFrontend: query cache found (%d bytes)", sendlen);

	/* forward cache to the frontend */
	pool_write(frontend, binary_cache, sendlen);

	/* send ReadyForQuery to the frontend*/
	pool_write(frontend, "Z", 1);
	sendlen = htonl(5);
	pool_write(frontend, &sendlen, sizeof(int));
	if (pool_write_and_flush(frontend, &tstate, 1) < 0)
	{
		pool_error("pool_query_cache_lookup: error while writing data to the frontend");
		PQfreemem(binary_cache);
		return -1;
	}

	PQfreemem(binary_cache);
	return 0;
}
开发者ID:mfyang,项目名称:pgpool-II,代码行数:38,代码来源:pool_query_cache.c

示例7: pool_unset_transaction_isolation

/*
 * Forget transaction isolation mode
 */
void pool_unset_transaction_isolation(void)
{
	if (!session_context)
	{
		pool_error("pool_unset_transaction_isolation: session context is not initialized");
		return;
	}
	pool_debug("pool_unset_transaction_isolation: done");
	session_context->transaction_isolation = POOL_UNKNOWN;
}
开发者ID:Randalthor80,项目名称:pgpool2,代码行数:13,代码来源:pool_session_context.c

示例8: pool_set_command_success

/*
 * The command in progress has succeeded.
 */
void pool_set_command_success(void)
{
	if (!session_context)
	{
		pool_error("pool_set_command_success: session context is not initialized");
		return;
	}
	pool_debug("pool_set_command_success: done");
	session_context->command_success = true;
}
开发者ID:Randalthor80,项目名称:pgpool2,代码行数:13,代码来源:pool_session_context.c

示例9: pool_set_transaction_isolation

/*
 * Set transaction isolation mode
 */
void pool_set_transaction_isolation(POOL_TRANSACTION_ISOLATION isolation_level)
{
	if (!session_context)
	{
		pool_error("pool_set_transaction_isolation: session context is not initialized");
		return;
	}
	pool_debug("pool_set_transaction_isolation: done");
	session_context->transaction_isolation = isolation_level;
}
开发者ID:Randalthor80,项目名称:pgpool2,代码行数:13,代码来源:pool_session_context.c

示例10: exec_recovery

/*
 * Call pgpool_recovery() function.
 */
static int exec_recovery(PGconn *conn, BackendInfo *backend, char stage)
{
	PGresult *result;
	char *hostname;
	char *script;
	int r;

	if (strlen(backend->backend_hostname) == 0 || *(backend->backend_hostname) == '/')
		hostname = "localhost";
	else
		hostname = backend->backend_hostname;

	script = (stage == FIRST_STAGE) ?
		pool_config->recovery_1st_stage_command : pool_config->recovery_2nd_stage_command;

	if (script == NULL || strlen(script) == 0)
	{
		/* do not execute script */
		return 0;
	}

	snprintf(recovery_command,
			 sizeof(recovery_command),
			 "SELECT pgpool_recovery('%s', '%s', '%s')",
			 script,
			 hostname,
			 backend->backend_data_directory);

	pool_log("starting recovery command: \"%s\"", recovery_command);

	pool_debug("exec_recovery: start recovery");
	result = PQexec(conn, recovery_command);
	r = (PQresultStatus(result) !=  PGRES_TUPLES_OK);
	if (r != 0)
	{
		pool_error("exec_recovery: %s command failed at %s",
				   script,
				   (stage == FIRST_STAGE) ? "1st stage" : "2nd stage");
	}
	PQclear(result);
	pool_debug("exec_recovery: finish recovery");
	return r;
}
开发者ID:aerfaman,项目名称:pgpool2,代码行数:46,代码来源:recovery.c

示例11: pool_unset_writing_transaction

/*
 * We don't have a write query in this transaction yet.
 */
void pool_unset_writing_transaction(void)
{
	if (!session_context)
	{
		pool_error("pool_unset_writing_transaction: session context is not initialized");
		return;
	}
	pool_debug("pool_unset_writing_transaction: done");
	session_context->writing_transaction = false;
}
开发者ID:Randalthor80,项目名称:pgpool2,代码行数:13,代码来源:pool_session_context.c

示例12: wd_stand_for_master

int
wd_stand_for_master(void)
{
	int rtn;

	/* send stand for master packet */
	pool_debug("wd_stand_for_master: send the packet to be the new master");
	rtn = wd_send_packet_no(WD_STAND_FOR_MASTER);
	return rtn;
}
开发者ID:ZheYuan,项目名称:prestogres,代码行数:10,代码来源:wd_packet.c

示例13: pool_set_failed_transaction

/*
 * Error occurred in this transaction.
 */
void pool_set_failed_transaction(void)
{
	if (!session_context)
	{
		pool_error("pool_set_failed_transaction: session context is not initialized");
		return;
	}
	pool_debug("pool_set_failed_transaction: done");
	session_context->failed_transaction = true;
}
开发者ID:Randalthor80,项目名称:pgpool2,代码行数:13,代码来源:pool_session_context.c

示例14: exit_handler

static RETSIGTYPE exit_handler(int sig)
{
	int i;

	POOL_SETMASK(&AuthBlockSig);

	/*
	 * this could happen in a child process if a signal has been sent
	 * before resetting signal handler
	 */
	if (getpid() != mypid)
	{
		pool_debug("exit_handler: I am not parent");
		POOL_SETMASK(&UnBlockSig);
		pool_shmem_exit(0);
		exit(0);
	}

	if (sig == SIGTERM)
		pool_log("received smart shutdown request");
	else if (sig == SIGINT)
		pool_log("received fast shutdown request");
	else if (sig == SIGQUIT)
		pool_log("received immediate shutdown request");
	else
	{
		pool_error("exit_handler: unknown signal received %d", sig);
		POOL_SETMASK(&UnBlockSig);
		return;
	}

	exiting = 1;

	for (i = 0; i < pool_config->num_init_children; i++)
	{
		pid_t pid = pids[i].pid;
		if (pid)
		{
			kill(pid, sig);
		}
	}

	kill(pcp_pid, sig);

	POOL_SETMASK(&UnBlockSig);

	while (wait(NULL) > 0)
		;

	if (errno != ECHILD)
		pool_error("wait() failed. reason:%s", strerror(errno));

	pids = NULL;
	myexit(0);
}
开发者ID:machack666,项目名称:pgpool-II,代码行数:55,代码来源:main.c

示例15: wd_declare

int
wd_declare(void)
{
	int rtn;

	/* send declare new master packet */
	pool_debug("wd_declare: send the packet to declare the new master");

	rtn = wd_send_packet_no(WD_DECLARE_NEW_MASTER);
	return rtn;
}
开发者ID:ZheYuan,项目名称:prestogres,代码行数:11,代码来源:wd_packet.c


注:本文中的pool_debug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。