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


C++ DB_ENV::get_tx_max方法代码示例

本文整理汇总了C++中DB_ENV::get_tx_max方法的典型用法代码示例。如果您正苦于以下问题:C++ DB_ENV::get_tx_max方法的具体用法?C++ DB_ENV::get_tx_max怎么用?C++ DB_ENV::get_tx_max使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB_ENV的用法示例。


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

示例1: TestSetTxMax

int TestSetTxMax(CuTest *ct) {
	DB_ENV *dbenv;
	u_int32_t v;

	dbenv = NULL;
	/* tx_max: NOT reset at run-time. */
	ENV
	CuAssertTrue(ct, dbenv->set_tx_max(dbenv, 37) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv,
	    TEST_ENV, DB_CREATE | DB_INIT_TXN, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_tx_max(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 37);
	ENV
	CuAssertTrue(ct, dbenv->set_tx_max(dbenv, 63) == 0);
	CuAssertTrue(ct, dbenv->open(dbenv, TEST_ENV, DB_JOINENV, 0666) == 0);
	CuAssertTrue(ct, dbenv->get_tx_max(dbenv, &v) == 0);
	CuAssertTrue(ct, v == 37);
	return (0);
}
开发者ID:CompassHXM,项目名称:h-store,代码行数:19,代码来源:TestEnvConfig.c

示例2:

void
env_open(DB_ENV **dbenvp)
{
	DB_ENV *dbenv;
	int ret;

	/* Create the environment handle. */
	if ((ret = db_env_create(&dbenv, 0)) != 0) {
		fprintf(stderr,
		    "txnapp: db_env_create: %s\n", db_strerror(ret));
		exit (1);
	}

	/* Set up error handling. */
	dbenv->set_errpfx(dbenv, "txnapp");
	dbenv->set_errfile(dbenv, stderr);

	// match lladd's defaults...
	dbenv->set_lg_bsize(dbenv, 1024*1024);
	// match lladd's defaults...
	dbenv->set_cachesize(dbenv, 0, 8204288, 0);


	/* Do deadlock detection internally. */
	/*	if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)) != 0) {
		dbenv->err(dbenv, ret, "set_lk_detect: DB_LOCK_DEFAULT");
		exit (1);
		}*/

	dbenv->set_tx_max(dbenv, 32000);
	unsigned int max;
	dbenv->get_tx_max(dbenv, &max);
	printf("Max xact count: %d\n", max);


	/*
	 * Open a transactional environment:
	 *	create if it doesn't exist
	 *	free-threaded handle
	 *	run recovery
	 *	read/write owner only
	 */
	if ((ret = dbenv->open(dbenv, ENV_DIRECTORY,
			       DB_CREATE |/* DB_INIT_LOCK |*/ DB_INIT_LOG |  DB_PRIVATE | 
			       DB_INIT_MPOOL | DB_INIT_TXN | DB_RECOVER | DB_THREAD,
			       S_IRUSR | S_IWUSR)) != 0) {
		dbenv->err(dbenv, ret, "dbenv->open: %s", ENV_DIRECTORY);
		exit (1);
	}

	*dbenvp = dbenv;
}
开发者ID:DreamtoucherN01,项目名称:stasis,代码行数:52,代码来源:genericBerkeleyDBCode.c

示例3: sizeof

int
main()
{
	const u_int8_t *lk_conflicts;
	DB_ENV *dbenv;
	db_timeout_t timeout;
	u_int32_t a, b, v;
	int lk_modes, ncache, nmodes;
	u_int8_t conflicts[40];

	dbenv = NULL;

	/* tx_max: NOT reset at run-time. */
	system("rm -rf TESTDIR; mkdir TESTDIR");
	ENV
	assert(dbenv->set_tx_max(dbenv, 37) == 0);
	assert(dbenv->open(dbenv,
	    "TESTDIR", DB_CREATE | DB_INIT_TXN, 0666) == 0);
	assert(dbenv->get_tx_max(dbenv, &v) == 0);
	assert(v == 37);
	ENV
	assert(dbenv->set_tx_max(dbenv, 63) == 0);
	assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
	assert(dbenv->get_tx_max(dbenv, &v) == 0);
	assert(v == 37);

	/* lg_max: reset at run-time. */
	system("rm -rf TESTDIR; mkdir TESTDIR");
	ENV
	assert(dbenv->set_lg_max(dbenv, 37 * 1024 * 1024) == 0);
	assert(dbenv->open(dbenv,
	    "TESTDIR", DB_CREATE | DB_INIT_LOG, 0666) == 0);
	assert(dbenv->get_lg_max(dbenv, &v) == 0);
	assert(v == 37 * 1024 * 1024);
	ENV
	assert(dbenv->set_lg_max(dbenv, 63 * 1024 * 1024) == 0);
	assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
	assert(dbenv->get_lg_max(dbenv, &v) == 0);
	assert(v == 63 * 1024 * 1024);

	/* lg_bsize: NOT reset at run-time. */
	system("rm -rf TESTDIR; mkdir TESTDIR");
	ENV
	assert(dbenv->set_lg_bsize(dbenv, 37 * 1024) == 0);
	assert(dbenv->open(dbenv,
	    "TESTDIR", DB_CREATE | DB_INIT_LOG, 0666) == 0);
	assert(dbenv->get_lg_bsize(dbenv, &v) == 0);
	assert(v == 37 * 1024);
	ENV
	assert(dbenv->set_lg_bsize(dbenv, 63 * 1024) == 0);
	assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
	assert(dbenv->get_lg_bsize(dbenv, &v) == 0);
	assert(v == 37 * 1024);

	/* lg_regionmax: NOT reset at run-time. */
	system("rm -rf TESTDIR; mkdir TESTDIR");
	ENV
	assert(dbenv->set_lg_regionmax(dbenv, 137 * 1024) == 0);
	assert(dbenv->open(dbenv,
	    "TESTDIR", DB_CREATE | DB_INIT_LOG, 0666) == 0);
	assert(dbenv->get_lg_regionmax(dbenv, &v) == 0);
	assert(v == 137 * 1024);
	ENV
	assert(dbenv->set_lg_regionmax(dbenv, 163 * 1024) == 0);
	assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
	assert(dbenv->get_lg_regionmax(dbenv, &v) == 0);
	assert(v == 137 * 1024);

	/* lk_get_lk_conflicts: NOT reset at run-time. */
	system("rm -rf TESTDIR; mkdir TESTDIR");
	ENV
	memset(conflicts, 'a', sizeof(conflicts));
	nmodes = 6;
	assert(dbenv->set_lk_conflicts(dbenv, conflicts, nmodes) == 0);
	assert(dbenv->open(dbenv,
	    "TESTDIR", DB_CREATE | DB_INIT_LOCK, 0666) == 0);
	assert(dbenv->get_lk_conflicts(dbenv, &lk_conflicts, &lk_modes) == 0);
	assert(lk_conflicts[0] == 'a');
	assert(lk_modes == 6);
	ENV
	memset(conflicts, 'b', sizeof(conflicts));
	nmodes = 8;
	assert(dbenv->set_lk_conflicts(dbenv, conflicts, nmodes) == 0);
	assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
	assert(dbenv->get_lk_conflicts(dbenv, &lk_conflicts, &lk_modes) == 0);
	assert(lk_conflicts[0] == 'a');
	assert(lk_modes == 6);

	/* lk_detect: NOT reset at run-time. */
	system("rm -rf TESTDIR; mkdir TESTDIR");
	ENV
	assert(dbenv->set_lk_detect(dbenv, DB_LOCK_MAXLOCKS) == 0);
	assert(dbenv->open(dbenv,
	    "TESTDIR", DB_CREATE | DB_INIT_LOCK, 0666) == 0);
	assert(dbenv->get_lk_detect(dbenv, &v) == 0);
	assert(v == DB_LOCK_MAXLOCKS);
	ENV
	assert(dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT) == 0);
	assert(dbenv->open(dbenv, "TESTDIR", DB_JOINENV, 0666) == 0);
	assert(dbenv->get_lk_detect(dbenv, &v) == 0);
//.........这里部分代码省略.........
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:101,代码来源:test_env_config.c


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