1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Replace uses of heap_open et al with the corresponding table_* function.

Author: Andres Freund
Discussion: https://postgr.es/m/20190111000539.xbv7s6w7ilcvm7dp@alap3.anarazel.de
This commit is contained in:
Andres Freund
2019-01-21 10:32:19 -08:00
parent 111944c5ee
commit e0c4ec0728
114 changed files with 1259 additions and 1259 deletions

View File

@@ -390,9 +390,9 @@ bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm)
* iterate on the revmap.
*/
heapOid = IndexGetRelation(RelationGetRelid(idxRel), false);
heapRel = heap_open(heapOid, AccessShareLock);
heapRel = table_open(heapOid, AccessShareLock);
nblocks = RelationGetNumberOfBlocks(heapRel);
heap_close(heapRel, AccessShareLock);
table_close(heapRel, AccessShareLock);
/*
* Make room for the consistent support procedures of indexed columns. We
@@ -799,15 +799,15 @@ brinvacuumcleanup(IndexVacuumInfo *info, IndexBulkDeleteResult *stats)
stats->num_pages = RelationGetNumberOfBlocks(info->index);
/* rest of stats is initialized by zeroing */
heapRel = heap_open(IndexGetRelation(RelationGetRelid(info->index), false),
AccessShareLock);
heapRel = table_open(IndexGetRelation(RelationGetRelid(info->index), false),
AccessShareLock);
brin_vacuum_scan(info->index, info->strategy);
brinsummarize(info->index, heapRel, BRIN_ALL_BLOCKRANGES, false,
&stats->num_index_tuples, &stats->num_index_tuples);
heap_close(heapRel, AccessShareLock);
table_close(heapRel, AccessShareLock);
return stats;
}
@@ -897,7 +897,7 @@ brin_summarize_range(PG_FUNCTION_ARGS)
*/
heapoid = IndexGetRelation(indexoid, true);
if (OidIsValid(heapoid))
heapRel = heap_open(heapoid, ShareUpdateExclusiveLock);
heapRel = table_open(heapoid, ShareUpdateExclusiveLock);
else
heapRel = NULL;
@@ -974,7 +974,7 @@ brin_desummarize_range(PG_FUNCTION_ARGS)
*/
heapoid = IndexGetRelation(indexoid, true);
if (OidIsValid(heapoid))
heapRel = heap_open(heapoid, ShareUpdateExclusiveLock);
heapRel = table_open(heapoid, ShareUpdateExclusiveLock);
else
heapRel = NULL;

View File

@@ -8990,10 +8990,10 @@ heap_sync(Relation rel)
{
Relation toastrel;
toastrel = heap_open(rel->rd_rel->reltoastrelid, AccessShareLock);
toastrel = table_open(rel->rd_rel->reltoastrelid, AccessShareLock);
FlushRelationBuffers(toastrel);
smgrimmedsync(toastrel->rd_smgr, MAIN_FORKNUM);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
}
}

View File

@@ -1422,7 +1422,7 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock)
Relation toastrel;
/* Open the toast relation */
toastrel = heap_open(toastoid, lock);
toastrel = table_open(toastoid, lock);
/* Look for the valid index of the toast relation */
validIndex = toast_open_indexes(toastrel,
@@ -1433,7 +1433,7 @@ toast_get_valid_index(Oid toastoid, LOCKMODE lock)
/* Close the toast relation and all its indexes */
toast_close_indexes(toastidxs, num_indexes, lock);
heap_close(toastrel, lock);
table_close(toastrel, lock);
return validIndexOid;
}
@@ -1487,7 +1487,7 @@ toast_save_datum(Relation rel, Datum value,
* uniqueness of the OID we assign to the toasted item, even though it has
* additional columns besides OID.
*/
toastrel = heap_open(rel->rd_rel->reltoastrelid, RowExclusiveLock);
toastrel = table_open(rel->rd_rel->reltoastrelid, RowExclusiveLock);
toasttupDesc = toastrel->rd_att;
/* Open all the toast indexes and look for the valid one */
@@ -1692,7 +1692,7 @@ toast_save_datum(Relation rel, Datum value,
* Done - close toast relation and its indexes
*/
toast_close_indexes(toastidxs, num_indexes, RowExclusiveLock);
heap_close(toastrel, RowExclusiveLock);
table_close(toastrel, RowExclusiveLock);
/*
* Create the TOAST pointer value that we'll return
@@ -1734,7 +1734,7 @@ toast_delete_datum(Relation rel, Datum value, bool is_speculative)
/*
* Open the toast relation and its indexes
*/
toastrel = heap_open(toast_pointer.va_toastrelid, RowExclusiveLock);
toastrel = table_open(toast_pointer.va_toastrelid, RowExclusiveLock);
/* Fetch valid relation used for process */
validIndex = toast_open_indexes(toastrel,
@@ -1774,7 +1774,7 @@ toast_delete_datum(Relation rel, Datum value, bool is_speculative)
*/
systable_endscan_ordered(toastscan);
toast_close_indexes(toastidxs, num_indexes, RowExclusiveLock);
heap_close(toastrel, RowExclusiveLock);
table_close(toastrel, RowExclusiveLock);
}
@@ -1840,11 +1840,11 @@ toastid_valueid_exists(Oid toastrelid, Oid valueid)
bool result;
Relation toastrel;
toastrel = heap_open(toastrelid, AccessShareLock);
toastrel = table_open(toastrelid, AccessShareLock);
result = toastrel_valueid_exists(toastrel, valueid);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
return result;
}
@@ -1899,7 +1899,7 @@ toast_fetch_datum(struct varlena *attr)
/*
* Open the toast relation and its indexes
*/
toastrel = heap_open(toast_pointer.va_toastrelid, AccessShareLock);
toastrel = table_open(toast_pointer.va_toastrelid, AccessShareLock);
toasttupDesc = toastrel->rd_att;
/* Look for the valid index of the toast relation */
@@ -2016,7 +2016,7 @@ toast_fetch_datum(struct varlena *attr)
*/
systable_endscan_ordered(toastscan);
toast_close_indexes(toastidxs, num_indexes, AccessShareLock);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
return result;
}
@@ -2102,7 +2102,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
/*
* Open the toast relation and its indexes
*/
toastrel = heap_open(toast_pointer.va_toastrelid, AccessShareLock);
toastrel = table_open(toast_pointer.va_toastrelid, AccessShareLock);
toasttupDesc = toastrel->rd_att;
/* Look for the valid index of toast relation */
@@ -2249,7 +2249,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset, int32 length)
*/
systable_endscan_ordered(toastscan);
toast_close_indexes(toastidxs, num_indexes, AccessShareLock);
heap_close(toastrel, AccessShareLock);
table_close(toastrel, AccessShareLock);
return result;
}

View File

@@ -1550,7 +1550,7 @@ _bt_parallel_build_main(dsm_segment *seg, shm_toc *toc)
}
/* Open relations within worker */
heapRel = heap_open(btshared->heaprelid, heapLockmode);
heapRel = table_open(btshared->heaprelid, heapLockmode);
indexRel = index_open(btshared->indexrelid, indexLockmode);
/* Initialize worker's own spool */
@@ -1595,7 +1595,7 @@ _bt_parallel_build_main(dsm_segment *seg, shm_toc *toc)
#endif /* BTREE_BUILD_STATS */
index_close(indexRel, indexLockmode);
heap_close(heapRel, heapLockmode);
table_close(heapRel, heapLockmode);
}
/*