Esempio n. 1
0
/*
 * Initialize the shared-memory for this module.
 */
void PersistentRelation_ShmemInit(void)
{
    bool found;

    /* Create the shared-memory structure. */
    persistentRelationSharedData =
        (PersistentRelationSharedData *)
        ShmemInitStruct("Mirrored Rel File Data",
                        PersistentRelation_SharedDataSize(),
                        &found);

    if (!found)
    {
        PersistentFileSysObj_InitShared(
            &persistentRelationSharedData->fileSysObjSharedData);
    }

    PersistentFileSysObj_Init(
        &persistentRelationData.fileSysObjData,
        &persistentRelationSharedData->fileSysObjSharedData,
        PersistentFsObjType_RelationFile,
        /* scanTupleCallback */ NULL);

    Assert(persistentRelationSharedData != NULL);
}
Esempio n. 2
0
/*
 * Return the required shared-memory size for this module.
 */
Size PersistentRelation_ShmemSize(void)
{
    Size size = 0;

    /* The shared-memory structure. */
    size = add_size(size, PersistentRelation_SharedDataSize());

    return size;
}
/*
 * Return the required shared-memory size for this module.
 */
Size PersistentRelation_ShmemSize(void)
{
	Size size;

	/* The hash table of persistent relations */
	size = hash_estimate_size((Size)gp_max_relations,
							sizeof(RelationDirEntryData));

	/* The shared-memory structure. */
	size = add_size(size, PersistentRelation_SharedDataSize());

	elog(LOG, "PersistentRelation_ShmemSize: %zu = "
			"gp_max_relations: %d "
			"* sizeof(RelationDirEntryData): %zu "
			"+ PersistentRelation_SharedDataSize(): %zu",
			size,
			gp_max_relations,
			sizeof(RelationDirEntryData),
			PersistentRelation_SharedDataSize());

	return size;
}
/*
 * Initialize the shared-memory for this module.
 */
void PersistentRelation_ShmemInit(void)
{
	bool found;
	bool ok;

	/* Create the shared-memory structure. */
	persistentRelationSharedData =
			(PersistentRelationSharedData *)
							ShmemInitStruct("Mirrored Relation Data",
											PersistentRelation_SharedDataSize(),
											&found);

	if (!found)
	{
		PersistentFileSysObj_InitShared(
						&persistentRelationSharedData->fileSysObjSharedData);
	}

	/* Create or find our shared-memory hash table. */
	ok = PersistentRelation_HashTableInit();
	if (!ok)
	{
		ereport(FATAL,
				(errcode(ERRCODE_OUT_OF_MEMORY),
				errmsg("Not enough shared memory for persistent relation hash table")));
	}

	PersistentFileSysObj_Init(
						&persistentRelationData.fileSysObjData,
						&persistentRelationSharedData->fileSysObjSharedData,
						PersistentFsObjType_RelationDir,
						PersistentRelation_ScanTupleCallback);

	Assert(persistentRelationSharedData != NULL);
	Assert(persistentRelationSharedHashTable != NULL);
}