Cleanup: use table_open, not heap_open. (#4506)

Co-authored-by: Jeff Davis <jefdavi@microsoft.com>
pull/4503/head
jeff-davis 2021-01-13 12:08:46 -08:00 committed by GitHub
parent ec319faa43
commit 9cffd41389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 17 deletions

View File

@ -353,7 +353,7 @@ ReadColumnarOptions(Oid regclass, ColumnarOptions *options)
Relation index = try_relation_open(ColumnarOptionsIndexRegclass(), AccessShareLock); Relation index = try_relation_open(ColumnarOptionsIndexRegclass(), AccessShareLock);
if (index == NULL) if (index == NULL)
{ {
heap_close(columnarOptions, NoLock); table_close(columnarOptions, NoLock);
/* extension has been dropped */ /* extension has been dropped */
return false; return false;
@ -403,7 +403,7 @@ SaveStripeSkipList(RelFileNode relfilenode, uint64 stripe, StripeSkipList *strip
ColumnarMetapage *metapage = ReadMetapage(relfilenode, false); ColumnarMetapage *metapage = ReadMetapage(relfilenode, false);
Oid cstoreSkipNodesOid = CStoreSkipNodesRelationId(); Oid cstoreSkipNodesOid = CStoreSkipNodesRelationId();
Relation cstoreSkipNodes = heap_open(cstoreSkipNodesOid, RowExclusiveLock); Relation cstoreSkipNodes = table_open(cstoreSkipNodesOid, RowExclusiveLock);
ModifyState *modifyState = StartModifyRelation(cstoreSkipNodes); ModifyState *modifyState = StartModifyRelation(cstoreSkipNodes);
for (columnIndex = 0; columnIndex < columnCount; columnIndex++) for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
@ -452,7 +452,7 @@ SaveStripeSkipList(RelFileNode relfilenode, uint64 stripe, StripeSkipList *strip
} }
FinishModifyRelation(modifyState); FinishModifyRelation(modifyState);
heap_close(cstoreSkipNodes, NoLock); table_close(cstoreSkipNodes, NoLock);
CommandCounterIncrement(); CommandCounterIncrement();
} }
@ -473,7 +473,7 @@ ReadStripeSkipList(RelFileNode relfilenode, uint64 stripe, TupleDesc tupleDescri
ColumnarMetapage *metapage = ReadMetapage(relfilenode, false); ColumnarMetapage *metapage = ReadMetapage(relfilenode, false);
Oid cstoreSkipNodesOid = CStoreSkipNodesRelationId(); Oid cstoreSkipNodesOid = CStoreSkipNodesRelationId();
Relation cstoreSkipNodes = heap_open(cstoreSkipNodesOid, AccessShareLock); Relation cstoreSkipNodes = table_open(cstoreSkipNodesOid, AccessShareLock);
Relation index = index_open(CStoreSkipNodesIndexRelationId(), AccessShareLock); Relation index = index_open(CStoreSkipNodesIndexRelationId(), AccessShareLock);
ScanKeyInit(&scanKey[0], Anum_cstore_skipnodes_storageid, ScanKeyInit(&scanKey[0], Anum_cstore_skipnodes_storageid,
@ -561,7 +561,7 @@ ReadStripeSkipList(RelFileNode relfilenode, uint64 stripe, TupleDesc tupleDescri
systable_endscan_ordered(scanDescriptor); systable_endscan_ordered(scanDescriptor);
index_close(index, NoLock); index_close(index, NoLock);
heap_close(cstoreSkipNodes, NoLock); table_close(cstoreSkipNodes, NoLock);
return skipList; return skipList;
} }
@ -586,7 +586,7 @@ InsertStripeMetadataRow(uint64 storageId, StripeMetadata *stripe)
}; };
Oid cstoreStripesOid = CStoreStripesRelationId(); Oid cstoreStripesOid = CStoreStripesRelationId();
Relation cstoreStripes = heap_open(cstoreStripesOid, RowExclusiveLock); Relation cstoreStripes = table_open(cstoreStripesOid, RowExclusiveLock);
ModifyState *modifyState = StartModifyRelation(cstoreStripes); ModifyState *modifyState = StartModifyRelation(cstoreStripes);
@ -596,7 +596,7 @@ InsertStripeMetadataRow(uint64 storageId, StripeMetadata *stripe)
CommandCounterIncrement(); CommandCounterIncrement();
heap_close(cstoreStripes, NoLock); table_close(cstoreStripes, NoLock);
} }
@ -765,7 +765,7 @@ ReadDataFileStripeList(uint64 storageId, Snapshot snapshot)
Oid cstoreStripesOid = CStoreStripesRelationId(); Oid cstoreStripesOid = CStoreStripesRelationId();
Relation cstoreStripes = heap_open(cstoreStripesOid, AccessShareLock); Relation cstoreStripes = table_open(cstoreStripesOid, AccessShareLock);
Relation index = index_open(CStoreStripesIndexRelationId(), AccessShareLock); Relation index = index_open(CStoreStripesIndexRelationId(), AccessShareLock);
TupleDesc tupleDescriptor = RelationGetDescr(cstoreStripes); TupleDesc tupleDescriptor = RelationGetDescr(cstoreStripes);
@ -800,7 +800,7 @@ ReadDataFileStripeList(uint64 storageId, Snapshot snapshot)
systable_endscan_ordered(scanDescriptor); systable_endscan_ordered(scanDescriptor);
index_close(index, NoLock); index_close(index, NoLock);
heap_close(cstoreStripes, NoLock); table_close(cstoreStripes, NoLock);
return stripeMetadataList; return stripeMetadataList;
} }
@ -862,7 +862,7 @@ DeleteMetadataRows(RelFileNode relfilenode)
systable_endscan_ordered(scanDescriptor); systable_endscan_ordered(scanDescriptor);
index_close(index, NoLock); index_close(index, NoLock);
heap_close(cstoreStripes, NoLock); table_close(cstoreStripes, NoLock);
} }

View File

@ -36,16 +36,11 @@
#define TTS_EMPTY(slot) ((slot)->tts_isempty) #define TTS_EMPTY(slot) ((slot)->tts_isempty)
#define ExecForceStoreHeapTuple(tuple, slot, shouldFree) \ #define ExecForceStoreHeapTuple(tuple, slot, shouldFree) \
ExecStoreTuple(newTuple, tupleSlot, InvalidBuffer, shouldFree); ExecStoreTuple(newTuple, tupleSlot, InvalidBuffer, shouldFree);
#define table_open(r, l) heap_open(r, l)
#define table_close(r, l) heap_close(r, l)
#define TableScanDesc HeapScanDesc #define TableScanDesc HeapScanDesc
#define table_beginscan heap_beginscan #define table_beginscan heap_beginscan
#define table_endscan heap_endscan #define table_endscan heap_endscan
#endif
#if PG_VERSION_NUM >= 130000
#define heap_open table_open
#define heap_openrv table_openrv
#define heap_close table_close
#endif #endif
#endif /* CSTORE_COMPAT_H */ #endif /* CSTORE_COMPAT_H */