コード例 #1
0
ファイル: small_hash.c プロジェクト: Peaker/small_hash
void small_hash__table__init_dynamic(
    small_hash__table *table,
    struct small_hash__funcs *user_funcs, void *user_arg,
    unsigned min_anchors_count)
{
    init_internal(table, user_funcs, user_arg,
                  min_anchors_count, alloc_anchors(min_anchors_count), true);
    table->min_anchors_count = min_anchors_count;
    set_watermarks(table);
}
コード例 #2
0
/*
 * Open block directory relation, initialize scan keys and minipages
 * for ALTER TABLE ADD COLUMN operation.
 */
void
AppendOnlyBlockDirectory_Init_addCol(
	AppendOnlyBlockDirectory *blockDirectory,
	AppendOnlyEntry *aoEntry,
	Snapshot appendOnlyMetaDataSnapshot,
	FileSegInfo *segmentFileInfo,
	Relation aoRel,
	int segno,
	int numColumnGroups,
	bool isAOCol)
{
	Assert(aoEntry != NULL);

	blockDirectory->aoRel = aoRel;
	blockDirectory->appendOnlyMetaDataSnapshot = appendOnlyMetaDataSnapshot;

	if (!OidIsValid(aoEntry->blkdirrelid))
	{
		Assert(!OidIsValid(aoEntry->blkdiridxid));
		blockDirectory->blkdirRel = NULL;
		blockDirectory->blkdirIdx = NULL;
		blockDirectory->numColumnGroups = 0;
		return;
	}

	blockDirectory->segmentFileInfo = NULL;
	blockDirectory->totalSegfiles = -1;
	blockDirectory->currentSegmentFileInfo = segmentFileInfo;
	
	blockDirectory->currentSegmentFileNum = segno;
	blockDirectory->numColumnGroups = numColumnGroups;
	blockDirectory->isAOCol = isAOCol;
	blockDirectory->proj = NULL;

	Assert(OidIsValid(aoEntry->blkdirrelid));

	/*
	 * TODO: refactor the *_addCol* interface so that opening of
	 * blockdirectory relation and index, init_internal and
	 * corresponding cleanup in *_End_addCol() is called only once
	 * during the add-column operation.  Currently, this is being
	 * called for every appendonly segment.
	 */
	blockDirectory->blkdirRel =
		heap_open(aoEntry->blkdirrelid, RowExclusiveLock);

	Assert(OidIsValid(aoEntry->blkdiridxid));

	blockDirectory->blkdirIdx =
		index_open(aoEntry->blkdiridxid, RowExclusiveLock);

	init_internal(blockDirectory);
}
コード例 #3
0
ファイル: small_hash.c プロジェクト: Peaker/small_hash
void small_hash__table__init_static(
    small_hash__table *table,
    struct small_hash__funcs *user_funcs, void *user_arg,
    unsigned anchors_count,
    small_hash__anchor anchors[])
{
    memset(anchors, 0, anchors_count * sizeof *anchors);
    init_internal(table, user_funcs, user_arg, anchors_count, anchors, false);
    table->low_watermark = 0;
    table->high_watermark = 0;
    table->expensive_lookup_count = 0;
}
コード例 #4
0
/*
 * AppendOnlyBlockDirectory_Init_forSearch
 *
 * Initialize the block directory to handle the lookup.
 *
 * If the block directory relation for this appendonly relation
 * does not exist before calling this function, set blkdirRel
 * and blkdirIdx to NULL, and return.
 */
void
AppendOnlyBlockDirectory_Init_forSearch(
	AppendOnlyBlockDirectory *blockDirectory,
	AppendOnlyEntry *aoEntry,
	Snapshot appendOnlyMetaDataSnapshot,
	FileSegInfo **segmentFileInfo,
	int totalSegfiles,
	Relation aoRel,
	int numColumnGroups,
	bool isAOCol,
	bool *proj)
{
	Assert(aoEntry != NULL);

	blockDirectory->aoRel = aoRel;

	if (!OidIsValid(aoEntry->blkdirrelid))
	{
		Assert(!OidIsValid(aoEntry->blkdiridxid));
		blockDirectory->blkdirRel = NULL;
		blockDirectory->blkdirIdx = NULL;

		return;
	}

	ereportif(Debug_appendonly_print_blockdirectory, LOG,
				(errmsg("Append-only block directory init for search: "
						"(totalSegfiles, numColumnGroups, isAOCol)="
						"(%d, %d, %d)",
						totalSegfiles, numColumnGroups, isAOCol)));

	blockDirectory->segmentFileInfo = segmentFileInfo;
	blockDirectory->totalSegfiles = totalSegfiles;
	blockDirectory->aoRel = aoRel;
	blockDirectory->appendOnlyMetaDataSnapshot = appendOnlyMetaDataSnapshot;
	blockDirectory->numColumnGroups = numColumnGroups;
	blockDirectory->isAOCol = isAOCol;
	blockDirectory->proj = proj;
	blockDirectory->currentSegmentFileNum = -1;

	Assert(OidIsValid(aoEntry->blkdirrelid));

	blockDirectory->blkdirRel =
		heap_open(aoEntry->blkdirrelid, AccessShareLock);

	Assert(OidIsValid(aoEntry->blkdiridxid));

	blockDirectory->blkdirIdx =
		index_open(aoEntry->blkdiridxid, AccessShareLock);

	init_internal(blockDirectory);
}
コード例 #5
0
ファイル: input_common.cpp プロジェクト: SailorSat/cabmame
int input_module_base::init(const osd_options &options)
{
	m_options = &options;

	m_mouse_enabled = options.mouse();
	m_lightgun_enabled = options.lightgun();

	int result = init_internal();
	if (result != 0)
		return result;

	m_input_paused = false;
	m_input_enabled = true;

	return 0;
}
コード例 #6
0
void init(int buffer_width, int buffer_height)
{
	init_internal(buffer_width, buffer_height);
	switch_texture();
	init_internal(buffer_width, buffer_height);
}
コード例 #7
0
/*
 * AppendOnlyBlockDirectory_Init_forInsert
 *
 * Initialize the block directory to handle the inserts.
 *
 * If the block directory relation for this appendonly relation
 * does not exist before calling this function, set blkdirRel
 * and blkdirIdx to NULL, and return.
 */
void
AppendOnlyBlockDirectory_Init_forInsert(
	AppendOnlyBlockDirectory *blockDirectory,
	AppendOnlyEntry *aoEntry,
	Snapshot appendOnlyMetaDataSnapshot,
	FileSegInfo *segmentFileInfo,
	int64 lastSequence,
	Relation aoRel,
	int segno,
	int numColumnGroups,
	bool isAOCol)
{
	int groupNo;

	Assert(aoEntry != NULL);

	blockDirectory->aoRel = aoRel;
	blockDirectory->appendOnlyMetaDataSnapshot = appendOnlyMetaDataSnapshot;

	if (!OidIsValid(aoEntry->blkdirrelid))
	{
		Assert(!OidIsValid(aoEntry->blkdiridxid));
		blockDirectory->blkdirRel = NULL;
		blockDirectory->blkdirIdx = NULL;

		return;
	}

	blockDirectory->segmentFileInfo = NULL;
	blockDirectory->totalSegfiles = -1;
	blockDirectory->currentSegmentFileInfo = segmentFileInfo;
	
	blockDirectory->currentSegmentFileNum = segno;
	blockDirectory->numColumnGroups = numColumnGroups;
	blockDirectory->isAOCol = isAOCol;
	blockDirectory->proj = NULL;

	Assert(OidIsValid(aoEntry->blkdirrelid));

	blockDirectory->blkdirRel =
		heap_open(aoEntry->blkdirrelid, RowExclusiveLock);

	Assert(OidIsValid(aoEntry->blkdiridxid));

	blockDirectory->blkdirIdx =
		index_open(aoEntry->blkdiridxid, RowExclusiveLock);

	init_internal(blockDirectory);

	ereportif(Debug_appendonly_print_blockdirectory, LOG,
				(errmsg("Append-only block directory init for insert: "
						"(segno, numColumnGroups, isAOCol, lastSequence)="
						"(%d, %d, %d, " INT64_FORMAT ")",
						segno, numColumnGroups, isAOCol, lastSequence)));

	/*
	 * Load the last minipages from the block directory relation.
	 */
	for(groupNo = 0; groupNo < blockDirectory->numColumnGroups; groupNo++)
	{
		load_last_minipage(blockDirectory, lastSequence, groupNo);
	}
}