LWLockAcquire(Lsm3DictLock,LW_EXCLUSIVE);/* Obtain exclusive lock on dictionary: it will be released in utility hook */
Lsm3Entry=hash_search(Lsm3Dict,&RelationGetRelid(index),HASH_ENTER,&found);/* Setting Lsm3Entry indicates to utility hook that Lsm3 index was created */
if(!found)
{
lsm3_init_entry(Lsm3Entry,index);
}
index->rd_rel->relam=BTREE_AM_OID;
result=btbuild(heap,index,indexInfo);
index->rd_rel->relam=save_am;
returnresult;
}
/* Insert in active top index, on overflow swap active indexes and initiate merge to base index */
staticbool
lsm3_insert(Relationrel,Datum*values,bool*isnull,
ItemPointerht_ctid,RelationheapRel,
IndexUniqueCheckcheckUnique,
IndexInfo*indexInfo)
{
Lsm3DictEntry*entry=lsm3_get_entry(rel);
intactive_index;
uint64n_merges;/* used to check if merge was initiated by somebody else */