コード例 #1
0
ファイル: common.c プロジェクト: David-Gould/skytools
/*
 * fetch table struct from cache.
 */
static struct PgqTableInfo *find_table_info(Relation rel)
{
	struct PgqTableInfo *entry;
	bool found = false;

	init_module();

	entry = hash_search(tbl_cache_map, &rel->rd_id, HASH_ENTER, &found);
	if (!found || entry->invalid) {
		clean_info(entry, found);

		/*
		 * During fill_tbl_info() 2 events can happen:
		 * - table info reset
		 * - exception
		 * To survive both, always clean struct and tag
		 * as invalid but differently from reset.
		 */
		entry->invalid = 2;

		/* find info */
		fill_tbl_info(rel, entry);

		/*
		 * If no reset happened, it's valid.  Actual reset
		 * is postponed to next call.
		 */
		if (entry->invalid == 2)
			entry->invalid = false;
	}

	return entry;
}
コード例 #2
0
ファイル: common.c プロジェクト: ssinger/skytools
/*
 * fetch table struct from cache.
 */
static struct PgqTableInfo *find_table_info(Relation rel)
{
	struct PgqTableInfo *entry;
	bool found = false;

	init_module();

	entry = hash_search(tbl_cache_map, &rel->rd_id, HASH_ENTER, &found);
	if (!found || entry->invalid) {
		if (found)
			free_info(entry);
		fill_tbl_info(rel, entry);
	}

	return entry;
}