提交 8fe321af 编写于 作者: A Ashwin Agrawal

Add tablespace OID to gp_relation_node and its index.

Relfilenode is only unique within a tablespace. Across tablespaces same
relfilenode may be allocated within a database. Currently, gp_relation_node only
stores relfilenode and segment_num and has unique index using only those fields
without tablespace. So, it breaks for situations where same relfilenode gets
allocated to table within database.
上级 3ebb12b4
{ {
"__comment" : "Generated by process_foreign_keys.pl", "__comment" : "Generated by process_foreign_keys.pl",
"__info" : { "CATALOG_VERSION_NO" : "301612081" }, "__info" : { "CATALOG_VERSION_NO" : "301612161" },
"gp_distribution_policy" : { "gp_distribution_policy" : {
"foreign_keys" : [ "foreign_keys" : [
[ ["localoid"], "pg_class", ["oid"] ] [ ["localoid"], "pg_class", ["oid"] ]
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
[ ["objid"], "pg_class", ["oid"] ] [ ["objid"], "pg_class", ["oid"] ]
] ]
}, },
"gp_relation_node" : {
"foreign_keys" : [
[ ["relfilenode_oid"], "pg_class", ["oid"] ]
]
},
"pg_aggregate" : { "pg_aggregate" : {
"foreign_keys" : [ "foreign_keys" : [
[ ["aggfnoid"], "pg_proc", ["oid"] ], [ ["aggfnoid"], "pg_proc", ["oid"] ],
......
...@@ -53,10 +53,11 @@ AOCSCompaction_DropSegmentFile(Relation aorel, ...@@ -53,10 +53,11 @@ AOCSCompaction_DropSegmentFile(Relation aorel,
pseudoSegNo = (col*AOTupleId_MultiplierSegmentFileNum) + segno; pseudoSegNo = (col*AOTupleId_MultiplierSegmentFileNum) + segno;
if (!ReadGpRelationNode( if (!ReadGpRelationNode(
aorel->rd_node.relNode, aorel->rd_rel->reltablespace,
pseudoSegNo, aorel->rd_rel->relfilenode,
&persistentTid, pseudoSegNo,
&persistentSerialNum)) &persistentTid,
&persistentSerialNum))
{ {
/* There is nothing to drop */ /* There is nothing to drop */
return; return;
......
...@@ -688,10 +688,12 @@ static void OpenAOCSDatumStreams(AOCSInsertDesc desc) ...@@ -688,10 +688,12 @@ static void OpenAOCSDatumStreams(AOCSInsertDesc desc)
for (int i=0; i < nvp; i++) for (int i=0; i < nvp; i++)
{ {
if (desc->cur_segno > 0 && if (desc->cur_segno > 0 &&
ReadGpRelationNode(desc->aoi_rel->rd_node.relNode, ReadGpRelationNode(
(i * AOTupleId_MultiplierSegmentFileNum) + desc->cur_segno, desc->aoi_rel->rd_rel->reltablespace,
&persistentTid, desc->aoi_rel->rd_rel->relfilenode,
&persistentSerialNum)) (i * AOTupleId_MultiplierSegmentFileNum) + desc->cur_segno,
&persistentTid,
&persistentSerialNum))
{ {
elog(ERROR, "Found gp_relation_node entry for relation name %s, " elog(ERROR, "Found gp_relation_node entry for relation name %s, "
"relation Oid %u, relfilenode %u, segment file #%d " "relation Oid %u, relfilenode %u, segment file #%d "
......
...@@ -1885,6 +1885,7 @@ CheckCOConsistencyWithGpRelationNode( Snapshot snapshot, Relation rel, int total ...@@ -1885,6 +1885,7 @@ CheckCOConsistencyWithGpRelationNode( Snapshot snapshot, Relation rel, int total
snapshot, snapshot,
gp_relation_node, gp_relation_node,
rel->rd_id, rel->rd_id,
rel->rd_rel->reltablespace,
rel->rd_rel->relfilenode, rel->rd_rel->relfilenode,
&gpRelationNodeScan); &gpRelationNodeScan);
while ((NULL != GpRelationNodeGetNext( while ((NULL != GpRelationNodeGetNext(
......
...@@ -138,10 +138,11 @@ OpenAOSegmentFile( ...@@ -138,10 +138,11 @@ OpenAOSegmentFile(
int primaryError; int primaryError;
if (!ReadGpRelationNode( if (!ReadGpRelationNode(
rel->rd_node.relNode, rel->rd_rel->reltablespace,
segmentFileNum, rel->rd_rel->relfilenode,
&persistentTid, segmentFileNum,
&persistentSerialNum)) &persistentTid,
&persistentSerialNum))
{ {
if (logicalEof == 0) if (logicalEof == 0)
return false; return false;
......
...@@ -2187,6 +2187,7 @@ CheckAOConsistencyWithGpRelationNode( Snapshot snapshot, Relation rel, int total ...@@ -2187,6 +2187,7 @@ CheckAOConsistencyWithGpRelationNode( Snapshot snapshot, Relation rel, int total
snapshot, snapshot,
gp_relation_node, gp_relation_node,
rel->rd_id, rel->rd_id,
rel->rd_rel->reltablespace,
rel->rd_rel->relfilenode, rel->rd_rel->relfilenode,
&gpRelationNodeScan); &gpRelationNodeScan);
while ((NULL != GpRelationNodeGetNext( while ((NULL != GpRelationNodeGetNext(
......
...@@ -57,10 +57,11 @@ AppendOnlyCompaction_DropSegmentFile(Relation aorel, ...@@ -57,10 +57,11 @@ AppendOnlyCompaction_DropSegmentFile(Relation aorel,
int64 persistentSerialNum; int64 persistentSerialNum;
if (!ReadGpRelationNode( if (!ReadGpRelationNode(
aorel->rd_node.relNode, aorel->rd_rel->reltablespace,
segno, aorel->rd_rel->relfilenode,
&persistentTid, segno,
&persistentSerialNum)) &persistentTid,
&persistentSerialNum))
{ {
/* There is nothing to drop */ /* There is nothing to drop */
return; return;
......
...@@ -498,10 +498,12 @@ SetCurrentFileSegForWrite(AppendOnlyInsertDesc aoInsertDesc) ...@@ -498,10 +498,12 @@ SetCurrentFileSegForWrite(AppendOnlyInsertDesc aoInsertDesc)
*/ */
if (gp_appendonly_verify_eof && if (gp_appendonly_verify_eof &&
aoInsertDesc->cur_segno > 0 && aoInsertDesc->cur_segno > 0 &&
ReadGpRelationNode(aoInsertDesc->aoi_rel->rd_node.relNode, ReadGpRelationNode(
aoInsertDesc->cur_segno, aoInsertDesc->aoi_rel->rd_rel->reltablespace,
&persistentTid, aoInsertDesc->aoi_rel->rd_rel->relfilenode,
&persistentSerialNum)) aoInsertDesc->cur_segno,
&persistentTid,
&persistentSerialNum))
{ {
elog(ERROR, "Found gp_relation_node entry for relation name %s, " elog(ERROR, "Found gp_relation_node entry for relation name %s, "
"relation Oid %u, relfilenode %u, segment file #%d " "relation Oid %u, relfilenode %u, segment file #%d "
...@@ -547,19 +549,21 @@ SetCurrentFileSegForWrite(AppendOnlyInsertDesc aoInsertDesc) ...@@ -547,19 +549,21 @@ SetCurrentFileSegForWrite(AppendOnlyInsertDesc aoInsertDesc)
else else
{ {
if (!ReadGpRelationNode( if (!ReadGpRelationNode(
aoInsertDesc->aoi_rel->rd_node.relNode, aoInsertDesc->aoi_rel->rd_rel->reltablespace,
aoInsertDesc->cur_segno, aoInsertDesc->aoi_rel->rd_rel->relfilenode,
&persistentTid, aoInsertDesc->cur_segno,
&persistentSerialNum)) &persistentTid,
&persistentSerialNum))
{ {
elog(ERROR, "Did not find gp_relation_node entry for relation name" elog(ERROR, "Did not find gp_relation_node entry for relation name"
" %s, relation id %u, relfilenode %u, segment file #%d," " %s, relation id %u, tablespace %u, relfilenode %u, segment file #%d,"
" logical eof " INT64_FORMAT, " logical eof " INT64_FORMAT,
aoInsertDesc->aoi_rel->rd_rel->relname.data, aoInsertDesc->aoi_rel->rd_rel->relname.data,
aoInsertDesc->aoi_rel->rd_id, aoInsertDesc->aoi_rel->rd_id,
aoInsertDesc->aoi_rel->rd_node.relNode, aoInsertDesc->aoi_rel->rd_rel->reltablespace,
aoInsertDesc->cur_segno, aoInsertDesc->aoi_rel->rd_rel->relfilenode,
eof); aoInsertDesc->cur_segno,
eof);
} }
} }
......
...@@ -659,13 +659,16 @@ void GpRelationNode_GetValues( ...@@ -659,13 +659,16 @@ void GpRelationNode_GetValues(
void GpRelationNode_SetDatumValues( void GpRelationNode_SetDatumValues(
Datum *values, Datum *values,
Oid tablespaceOid,
Oid relfilenodeOid, Oid relfilenodeOid,
int32 segmentFileNum, int32 segmentFileNum,
int64 createMirrorDataLossTrackingSessionNum, int64 createMirrorDataLossTrackingSessionNum,
ItemPointer persistentTid, ItemPointer persistentTid,
int64 persistentSerialNum) int64 persistentSerialNum)
{ {
values[Anum_gp_relation_node_tablespace_oid - 1] =
ObjectIdGetDatum(tablespaceOid);
values[Anum_gp_relation_node_relfilenode_oid - 1] = values[Anum_gp_relation_node_relfilenode_oid - 1] =
ObjectIdGetDatum(relfilenodeOid); ObjectIdGetDatum(relfilenodeOid);
......
...@@ -1234,6 +1234,7 @@ InsertGpRelationNodeTuple( ...@@ -1234,6 +1234,7 @@ InsertGpRelationNodeTuple(
Relation gp_relation_node, Relation gp_relation_node,
Oid relationId, Oid relationId,
char *relname, char *relname,
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
int32 segmentFileNum, int32 segmentFileNum,
bool updateIndex, bool updateIndex,
...@@ -1269,8 +1270,15 @@ InsertGpRelationNodeTuple( ...@@ -1269,8 +1270,15 @@ InsertGpRelationNodeTuple(
persistentSerialNum, persistentSerialNum,
ItemPointerToString(persistentTid)); ItemPointerToString(persistentTid));
/*
* gp_relation_node stores tablespaceOId in pg_class fashion, which means
* defaultTablespace is represented as "0".
*/
Assert (tablespaceOid != MyDatabaseTableSpace);
GpRelationNode_SetDatumValues( GpRelationNode_SetDatumValues(
values, values,
tablespaceOid,
relfilenode, relfilenode,
segmentFileNum, segmentFileNum,
/* createMirrorDataLossTrackingSessionNum */ 0, /* createMirrorDataLossTrackingSessionNum */ 0,
...@@ -1295,6 +1303,7 @@ void ...@@ -1295,6 +1303,7 @@ void
UpdateGpRelationNodeTuple( UpdateGpRelationNodeTuple(
Relation gp_relation_node, Relation gp_relation_node,
HeapTuple tuple, HeapTuple tuple,
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
int32 segmentFileNum, int32 segmentFileNum,
ItemPointer persistentTid, ItemPointer persistentTid,
...@@ -1327,6 +1336,9 @@ UpdateGpRelationNodeTuple( ...@@ -1327,6 +1336,9 @@ UpdateGpRelationNodeTuple(
memset(repl_null, false, sizeof(repl_null)); memset(repl_null, false, sizeof(repl_null));
memset(repl_repl, false, sizeof(repl_null)); memset(repl_repl, false, sizeof(repl_null));
repl_repl[Anum_gp_relation_node_tablespace_oid - 1] = true;
repl_val[Anum_gp_relation_node_tablespace_oid - 1] = ObjectIdGetDatum(tablespaceOid);
repl_repl[Anum_gp_relation_node_relfilenode_oid - 1] = true; repl_repl[Anum_gp_relation_node_relfilenode_oid - 1] = true;
repl_val[Anum_gp_relation_node_relfilenode_oid - 1] = ObjectIdGetDatum(relfilenode); repl_val[Anum_gp_relation_node_relfilenode_oid - 1] = ObjectIdGetDatum(relfilenode);
...@@ -1362,6 +1374,7 @@ AddNewRelationNodeTuple( ...@@ -1362,6 +1374,7 @@ AddNewRelationNodeTuple(
gp_relation_node, gp_relation_node,
new_rel->rd_id, new_rel->rd_id,
new_rel->rd_rel->relname.data, new_rel->rd_rel->relname.data,
new_rel->rd_rel->reltablespace,
new_rel->rd_rel->relfilenode, new_rel->rd_rel->relfilenode,
/* segmentFileNum */ 0, /* segmentFileNum */ 0,
/* updateIndex */ true, /* updateIndex */ true,
...@@ -2323,6 +2336,7 @@ remove_gp_relation_node_and_schedule_drop(Relation rel) ...@@ -2323,6 +2336,7 @@ remove_gp_relation_node_and_schedule_drop(Relation rel)
SnapshotNow, SnapshotNow,
relNodeRelation, relNodeRelation,
rel->rd_id, rel->rd_id,
rel->rd_rel->reltablespace,
rel->rd_rel->relfilenode, rel->rd_rel->relfilenode,
&gpRelationNodeScan); &gpRelationNodeScan);
......
...@@ -730,6 +730,7 @@ index_create(Oid heapRelationId, ...@@ -730,6 +730,7 @@ index_create(Oid heapRelationId,
gp_relation_node, gp_relation_node,
indexRelation->rd_id, indexRelation->rd_id,
indexRelation->rd_rel->relname.data, indexRelation->rd_rel->relname.data,
indexRelation->rd_rel->reltablespace,
indexRelation->rd_rel->relfilenode, indexRelation->rd_rel->relfilenode,
/* segmentFileNum */ 0, /* segmentFileNum */ 0,
/* updateIndex */ true, /* updateIndex */ true,
...@@ -1549,6 +1550,7 @@ setNewRelfilenode(Relation relation, TransactionId freezeXid) ...@@ -1549,6 +1550,7 @@ setNewRelfilenode(Relation relation, TransactionId freezeXid)
gp_relation_node, gp_relation_node,
relation->rd_id, relation->rd_id,
NameStr(relation->rd_rel->relname), NameStr(relation->rd_rel->relname),
relation->rd_rel->reltablespace,
newrelfilenode, newrelfilenode,
/* segmentFileNum */ 0, /* segmentFileNum */ 0,
/* updateIndex */ !is_gp_relation_node_index, /* updateIndex */ !is_gp_relation_node_index,
......
...@@ -269,10 +269,12 @@ AppendOnlyStorageWrite_TransactionCreateFile(AppendOnlyStorageWrite *storageWrit ...@@ -269,10 +269,12 @@ AppendOnlyStorageWrite_TransactionCreateFile(AppendOnlyStorageWrite *storageWrit
/* /*
* We may or may not have a gp_relation_node entry when the EOF is 0. * We may or may not have a gp_relation_node entry when the EOF is 0.
*/ */
if (ReadGpRelationNode(relFileNode->relNode, if (ReadGpRelationNode(
segmentFileNum, (relFileNode->spcNode == MyDatabaseTableSpace) ? 0:relFileNode->spcNode,
persistentTid, relFileNode->relNode,
persistentSerialNum)) segmentFileNum,
persistentTid,
persistentSerialNum))
{ {
/* /*
* UNDONE: Verify the gp_persistent_relation_node Append-Only EOFs are * UNDONE: Verify the gp_persistent_relation_node Append-Only EOFs are
...@@ -296,6 +298,7 @@ AppendOnlyStorageWrite_TransactionCreateFile(AppendOnlyStorageWrite *storageWrit ...@@ -296,6 +298,7 @@ AppendOnlyStorageWrite_TransactionCreateFile(AppendOnlyStorageWrite *storageWrit
* currently only used * currently only used
* for tracing... */ * for tracing... */
storageWrite->relationName, storageWrite->relationName,
(relFileNode->spcNode == MyDatabaseTableSpace) ? 0:relFileNode->spcNode,
relFileNode->relNode, relFileNode->relNode,
segmentFileNum, segmentFileNum,
/* updateIndex */ true, /* updateIndex */ true,
......
...@@ -163,6 +163,7 @@ static void PersistentBuild_ScanGpPersistentRelationNodeForGlobal( ...@@ -163,6 +163,7 @@ static void PersistentBuild_ScanGpPersistentRelationNodeForGlobal(
gp_relation_node, gp_relation_node,
relFileNode.relNode, // pg_class OID relFileNode.relNode, // pg_class OID
/* relationName */ NULL, // Optional. /* relationName */ NULL, // Optional.
(relFileNode.spcNode == MyDatabaseTableSpace) ? 0:relFileNode.spcNode,
relFileNode.relNode, // pg_class relfilenode relFileNode.relNode, // pg_class relfilenode
/* segmentFileNum */ 0, /* segmentFileNum */ 0,
/* updateIndex */ false, /* updateIndex */ false,
...@@ -279,6 +280,7 @@ static void PersistentBuild_PopulateGpRelationNode( ...@@ -279,6 +280,7 @@ static void PersistentBuild_PopulateGpRelationNode(
gp_relation_node, gp_relation_node,
dbInfoRel->relationOid, // pg_class OID dbInfoRel->relationOid, // pg_class OID
dbInfoRel->relname, dbInfoRel->relname,
(dbInfoRel->reltablespace == MyDatabaseTableSpace) ? 0:dbInfoRel->reltablespace,
relFileNode.relNode, // pg_class relfilenode relFileNode.relNode, // pg_class relfilenode
/* segmentFileNum */ 0, /* segmentFileNum */ 0,
/* updateIndex */ false, /* updateIndex */ false,
...@@ -398,6 +400,7 @@ static void PersistentBuild_PopulateGpRelationNode( ...@@ -398,6 +400,7 @@ static void PersistentBuild_PopulateGpRelationNode(
gp_relation_node, gp_relation_node,
dbInfoRel->relationOid, // pg_class OID dbInfoRel->relationOid, // pg_class OID
dbInfoRel->relname, dbInfoRel->relname,
(dbInfoRel->reltablespace == MyDatabaseTableSpace) ? 0:dbInfoRel->reltablespace,
relFileNode.relNode, // pg_class relfilenode relFileNode.relNode, // pg_class relfilenode
physicalSegmentFileNum, physicalSegmentFileNum,
/* updateIndex */ false, /* updateIndex */ false,
...@@ -448,6 +451,7 @@ static void PersistentBuild_PopulateGpRelationNode( ...@@ -448,6 +451,7 @@ static void PersistentBuild_PopulateGpRelationNode(
indexInfo->ii_NumIndexAttrs = Natts_gp_relation_node_index; indexInfo->ii_NumIndexAttrs = Natts_gp_relation_node_index;
indexInfo->ii_KeyAttrNumbers[0] = 1; indexInfo->ii_KeyAttrNumbers[0] = 1;
indexInfo->ii_KeyAttrNumbers[1] = 2; indexInfo->ii_KeyAttrNumbers[1] = 2;
indexInfo->ii_KeyAttrNumbers[2] = 3;
indexInfo->ii_Unique = true; indexInfo->ii_Unique = true;
if (Debug_persistent_print) if (Debug_persistent_print)
......
...@@ -9525,8 +9525,6 @@ ATExecSetTableSpace_AppendOnly( ...@@ -9525,8 +9525,6 @@ ATExecSetTableSpace_AppendOnly(
Relation gp_relation_node, Relation gp_relation_node,
RelFileNode *newRelFileNode) RelFileNode *newRelFileNode)
{ {
Oid oldTablespace;
char *buffer; char *buffer;
GpRelationNodeScan gpRelationNodeScan; GpRelationNodeScan gpRelationNodeScan;
...@@ -9550,8 +9548,6 @@ ATExecSetTableSpace_AppendOnly( ...@@ -9550,8 +9548,6 @@ ATExecSetTableSpace_AppendOnly(
int segmentCount; int segmentCount;
oldTablespace = rel->rd_rel->reltablespace ? rel->rd_rel->reltablespace : MyDatabaseTableSpace;
if (Debug_persistent_print) if (Debug_persistent_print)
elog(Persistent_DebugPrintLevel(), elog(Persistent_DebugPrintLevel(),
"ALTER TABLE SET TABLESPACE: Append-Only " "ALTER TABLE SET TABLESPACE: Append-Only "
...@@ -9589,6 +9585,7 @@ ATExecSetTableSpace_AppendOnly( ...@@ -9589,6 +9585,7 @@ ATExecSetTableSpace_AppendOnly(
SnapshotNow, SnapshotNow,
gp_relation_node, gp_relation_node,
tableOid, tableOid,
rel->rd_rel->reltablespace,
rel->rd_rel->relfilenode, rel->rd_rel->relfilenode,
&gpRelationNodeScan); &gpRelationNodeScan);
segmentCount = 0; segmentCount = 0;
...@@ -9631,6 +9628,7 @@ ATExecSetTableSpace_AppendOnly( ...@@ -9631,6 +9628,7 @@ ATExecSetTableSpace_AppendOnly(
UpdateGpRelationNodeTuple( UpdateGpRelationNodeTuple(
gp_relation_node, gp_relation_node,
tupleCopy, tupleCopy,
(newRelFileNode->spcNode == MyDatabaseTableSpace) ? 0:newRelFileNode->spcNode,
newRelFileNode->relNode, newRelFileNode->relNode,
segmentFileNum, segmentFileNum,
&newPersistentTid, &newPersistentTid,
...@@ -9822,6 +9820,7 @@ ATExecSetTableSpace_BufferPool( ...@@ -9822,6 +9820,7 @@ ATExecSetTableSpace_BufferPool(
/* Fetch relation's gp_relation_node row */ /* Fetch relation's gp_relation_node row */
nodeTuple = FetchGpRelationNodeTuple( nodeTuple = FetchGpRelationNodeTuple(
gp_relation_node, gp_relation_node,
rel->rd_rel->reltablespace,
rel->rd_rel->relfilenode, rel->rd_rel->relfilenode,
/* segmentFileNum */ 0, /* segmentFileNum */ 0,
&oldPersistentTid, &oldPersistentTid,
...@@ -9889,6 +9888,7 @@ ATExecSetTableSpace_BufferPool( ...@@ -9889,6 +9888,7 @@ ATExecSetTableSpace_BufferPool(
UpdateGpRelationNodeTuple( UpdateGpRelationNodeTuple(
gp_relation_node, gp_relation_node,
nodeTuple, nodeTuple,
(newRelFileNode->spcNode == MyDatabaseTableSpace) ? 0:newRelFileNode->spcNode,
newRelFileNode->relNode, newRelFileNode->relNode,
/* segmentFileNum */ 0, /* segmentFileNum */ 0,
&newPersistentTid, &newPersistentTid,
......
...@@ -520,6 +520,7 @@ DefineQueryRewrite(char *rulename, ...@@ -520,6 +520,7 @@ DefineQueryRewrite(char *rulename,
SnapshotNow, SnapshotNow,
relNodeRelation, relNodeRelation,
event_relation->rd_id, event_relation->rd_id,
event_relation->rd_rel->reltablespace,
event_relation->rd_rel->relfilenode, event_relation->rd_rel->relfilenode,
&gpRelationNodeScan); &gpRelationNodeScan);
......
...@@ -313,6 +313,7 @@ GpRelationNodeBeginScan( ...@@ -313,6 +313,7 @@ GpRelationNodeBeginScan(
Snapshot snapshot, Snapshot snapshot,
Relation gp_relation_node, Relation gp_relation_node,
Oid relationId, Oid relationId,
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
GpRelationNodeScan *gpRelationNodeScan) GpRelationNodeScan *gpRelationNodeScan)
{ {
...@@ -323,25 +324,18 @@ GpRelationNodeBeginScan( ...@@ -323,25 +324,18 @@ GpRelationNodeBeginScan(
/* /*
* form a scan key * form a scan key
*/ */
/* XXX XXX: break this out -- find callers - jic 2011/12/09 */
/* maybe it's ok - return a cql context ? */
/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
/* no json defs for persistent tables ? */
/*
cqxx("SELECT * FROM gp_relation_node_relfilenode "
" WHERE oid = :1 ",
ObjectIdGetDatum(relfilenode));
*/
/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
ScanKeyInit(&gpRelationNodeScan->scankey[0], ScanKeyInit(&gpRelationNodeScan->scankey[0],
Anum_gp_relation_node_tablespace_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(tablespaceOid));
ScanKeyInit(&gpRelationNodeScan->scankey[1],
Anum_gp_relation_node_relfilenode_oid, Anum_gp_relation_node_relfilenode_oid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relfilenode)); ObjectIdGetDatum(relfilenode));
/* /*
* Open pg_class and fetch a tuple. Force heap scan if we haven't yet * Open gp_relation_node and fetch a tuple. Force heap scan if we haven't yet
* built the critical relcache entries (this includes initdb and startup * built the critical relcache entries (this includes initdb and startup
* without a pg_internal.init file). The caller can also force a heap * without a pg_internal.init file). The caller can also force a heap
* scan by setting indexOK == false. * scan by setting indexOK == false.
...@@ -350,11 +344,12 @@ GpRelationNodeBeginScan( ...@@ -350,11 +344,12 @@ GpRelationNodeBeginScan(
systable_beginscan(gp_relation_node, GpRelationNodeOidIndexId, systable_beginscan(gp_relation_node, GpRelationNodeOidIndexId,
/* indexOK */ true, /* indexOK */ true,
snapshot, snapshot,
/* nKeys */ 1, /* nKeys */ 2,
gpRelationNodeScan->scankey); gpRelationNodeScan->scankey);
gpRelationNodeScan->gp_relation_node = gp_relation_node; gpRelationNodeScan->gp_relation_node = gp_relation_node;
gpRelationNodeScan->relationId = relationId; gpRelationNodeScan->relationId = relationId;
gpRelationNodeScan->tablespaceOid = tablespaceOid;
gpRelationNodeScan->relfilenode = relfilenode; gpRelationNodeScan->relfilenode = relfilenode;
} }
...@@ -397,8 +392,9 @@ GpRelationNodeGetNext( ...@@ -397,8 +392,9 @@ GpRelationNodeGetNext(
persistentSerialNum); persistentSerialNum);
if (actualRelationNode != gpRelationNodeScan->relfilenode) if (actualRelationNode != gpRelationNodeScan->relfilenode)
elog(FATAL, "Index on gp_relation_node broken." elog(FATAL, "Index on gp_relation_node broken."
"Mismatch in node tuple for gp_relation_node for relation %u, relfilenode %u, relation node %u", "Mismatch in node tuple for gp_relation_node for relation %u, tablespace %u, relfilenode %u, relation node %u",
gpRelationNodeScan->relationId, gpRelationNodeScan->relationId,
gpRelationNodeScan->tablespaceOid,
gpRelationNodeScan->relfilenode, gpRelationNodeScan->relfilenode,
actualRelationNode); actualRelationNode);
...@@ -417,40 +413,35 @@ GpRelationNodeEndScan( ...@@ -417,40 +413,35 @@ GpRelationNodeEndScan(
static HeapTuple static HeapTuple
ScanGpRelationNodeTuple( ScanGpRelationNodeTuple(
Relation gp_relation_node, Relation gp_relation_node,
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
int32 segmentFileNum) int32 segmentFileNum)
{ {
HeapTuple tuple; HeapTuple tuple;
SysScanDesc scan; SysScanDesc scan;
ScanKeyData key[2]; ScanKeyData key[3];
Assert (tablespaceOid != MyDatabaseTableSpace);
Assert (relfilenode != 0); Assert (relfilenode != 0);
/* /*
* form a scan key * form a scan key
*/ */
/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
/*
cqxx("SELECT * FROM gp_relation_node "
" WHERE relfilenode_oid = :1 "
" AND segment_file_num = :2 ",
ObjectIdGetDatum(relfilenode),
Int32GetDatum(segmentFileNum));
*/
/* XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX */
ScanKeyInit(&key[0], ScanKeyInit(&key[0],
Anum_gp_relation_node_tablespace_oid,
BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(tablespaceOid));
ScanKeyInit(&key[1],
Anum_gp_relation_node_relfilenode_oid, Anum_gp_relation_node_relfilenode_oid,
BTEqualStrategyNumber, F_OIDEQ, BTEqualStrategyNumber, F_OIDEQ,
ObjectIdGetDatum(relfilenode)); ObjectIdGetDatum(relfilenode));
ScanKeyInit(&key[1], ScanKeyInit(&key[2],
Anum_gp_relation_node_segment_file_num, Anum_gp_relation_node_segment_file_num,
BTEqualStrategyNumber, F_INT4EQ, BTEqualStrategyNumber, F_INT4EQ,
Int32GetDatum(segmentFileNum)); Int32GetDatum(segmentFileNum));
/* /*
* Open pg_class and fetch a tuple. Force heap scan if we haven't yet * Open gp_relation_node and fetch a tuple. Force heap scan if we haven't yet
* built the critical relcache entries (this includes initdb and startup * built the critical relcache entries (this includes initdb and startup
* without a pg_internal.init file). The caller can also force a heap * without a pg_internal.init file). The caller can also force a heap
* scan by setting indexOK == false. * scan by setting indexOK == false.
...@@ -458,7 +449,7 @@ ScanGpRelationNodeTuple( ...@@ -458,7 +449,7 @@ ScanGpRelationNodeTuple(
scan = systable_beginscan(gp_relation_node, GpRelationNodeOidIndexId, scan = systable_beginscan(gp_relation_node, GpRelationNodeOidIndexId,
/* indexOK */ true, /* indexOK */ true,
SnapshotNow, SnapshotNow,
2, key); 3, key);
tuple = systable_getnext(scan); tuple = systable_getnext(scan);
...@@ -477,6 +468,7 @@ ScanGpRelationNodeTuple( ...@@ -477,6 +468,7 @@ ScanGpRelationNodeTuple(
HeapTuple HeapTuple
FetchGpRelationNodeTuple( FetchGpRelationNodeTuple(
Relation gp_relation_node, Relation gp_relation_node,
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
int32 segmentFileNum, int32 segmentFileNum,
ItemPointer persistentTid, ItemPointer persistentTid,
...@@ -492,10 +484,16 @@ FetchGpRelationNodeTuple( ...@@ -492,10 +484,16 @@ FetchGpRelationNodeTuple(
int64 createMirrorDataLossTrackingSessionNum; int64 createMirrorDataLossTrackingSessionNum;
/*
* gp_relation_node stores tablespaceOId in pg_class fashion, hence need
* to fetch the similar way.
*/
Assert (tablespaceOid != MyDatabaseTableSpace);
Assert (relfilenode != 0); Assert (relfilenode != 0);
tuple = ScanGpRelationNodeTuple( tuple = ScanGpRelationNodeTuple(
gp_relation_node, gp_relation_node,
tablespaceOid,
relfilenode, relfilenode,
segmentFileNum); segmentFileNum);
...@@ -547,14 +545,16 @@ DeleteGpRelationNodeTuple( ...@@ -547,14 +545,16 @@ DeleteGpRelationNodeTuple(
gp_relation_node = heap_open(GpRelationNodeRelationId, RowExclusiveLock); gp_relation_node = heap_open(GpRelationNodeRelationId, RowExclusiveLock);
tuple = FetchGpRelationNodeTuple(gp_relation_node, tuple = FetchGpRelationNodeTuple(gp_relation_node,
relation->rd_rel->relfilenode, relation->rd_rel->reltablespace,
segmentFileNum, relation->rd_rel->relfilenode,
&persistentTid, segmentFileNum,
&persistentSerialNum); &persistentTid,
&persistentSerialNum);
if (!HeapTupleIsValid(tuple)) if (!HeapTupleIsValid(tuple))
elog(ERROR, "could not find node tuple for relation %u, relation file node %u, segment file #%d", elog(ERROR, "could not find node tuple for relation %u, tablespace %u, relation file node %u, segment file #%d",
RelationGetRelid(relation), RelationGetRelid(relation),
relation->rd_rel->reltablespace,
relation->rd_rel->relfilenode, relation->rd_rel->relfilenode,
segmentFileNum); segmentFileNum);
...@@ -567,12 +567,10 @@ DeleteGpRelationNodeTuple( ...@@ -567,12 +567,10 @@ DeleteGpRelationNodeTuple(
bool bool
ReadGpRelationNode( ReadGpRelationNode(
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
int32 segmentFileNum, int32 segmentFileNum,
ItemPointer persistentTid, ItemPointer persistentTid,
int64 *persistentSerialNum) int64 *persistentSerialNum)
{ {
Relation gp_relation_node; Relation gp_relation_node;
...@@ -586,6 +584,7 @@ ReadGpRelationNode( ...@@ -586,6 +584,7 @@ ReadGpRelationNode(
tuple = FetchGpRelationNodeTuple( tuple = FetchGpRelationNodeTuple(
gp_relation_node, gp_relation_node,
tablespaceOid,
relfilenode, relfilenode,
segmentFileNum, segmentFileNum,
persistentTid, persistentTid,
...@@ -611,7 +610,8 @@ ReadGpRelationNode( ...@@ -611,7 +610,8 @@ ReadGpRelationNode(
tupleVisibilitySummaryString = GetTupleVisibilitySummaryString(&tupleVisibilitySummary); tupleVisibilitySummaryString = GetTupleVisibilitySummaryString(&tupleVisibilitySummary);
elog(Persistent_DebugPrintLevel(), elog(Persistent_DebugPrintLevel(),
"ReadGpRelationNode: For relfilenode %u, segment file #%d found persistent serial number " INT64_FORMAT ", TID %s (gp_relation_node tuple visibility: %s)", "ReadGpRelationNode: For tablespace %u relfilenode %u, segment file #%d found persistent serial number " INT64_FORMAT ", TID %s (gp_relation_node tuple visibility: %s)",
tablespaceOid,
relfilenode, relfilenode,
segmentFileNum, segmentFileNum,
*persistentSerialNum, *persistentSerialNum,
...@@ -647,15 +647,17 @@ RelationFetchSegFile0GpRelationNode( ...@@ -647,15 +647,17 @@ RelationFetchSegFile0GpRelationNode(
} }
if (!ReadGpRelationNode( if (!ReadGpRelationNode(
relation->rd_node.relNode, relation->rd_rel->reltablespace,
/* segmentFileNum */ 0, relation->rd_rel->relfilenode,
&relation->rd_segfile0_relationnodeinfo.persistentTid, /* segmentFileNum */ 0,
&relation->rd_segfile0_relationnodeinfo.persistentSerialNum)) &relation->rd_segfile0_relationnodeinfo.persistentTid,
&relation->rd_segfile0_relationnodeinfo.persistentSerialNum))
{ {
elog(ERROR, "Did not find gp_relation_node entry for relation name %s, relation id %u, relfilenode %u", elog(ERROR, "Did not find gp_relation_node entry for relation name %s, relation id %u, tablespaceOid %u, relfilenode %u",
relation->rd_rel->relname.data, relation->rd_rel->relname.data,
relation->rd_id, relation->rd_id,
relation->rd_node.relNode); relation->rd_rel->reltablespace,
relation->rd_rel->relfilenode);
} }
Assert(!Persistent_BeforePersistenceWork()); Assert(!Persistent_BeforePersistenceWork());
...@@ -686,15 +688,19 @@ RelationFetchSegFile0GpRelationNode( ...@@ -686,15 +688,19 @@ RelationFetchSegFile0GpRelationNode(
int64 persistentSerialNum; int64 persistentSerialNum;
if (!ReadGpRelationNode( if (!ReadGpRelationNode(
relation->rd_node.relNode, relation->rd_rel->reltablespace,
/* segmentFileNum */ 0, relation->rd_rel->relfilenode,
&persistentTid, /* segmentFileNum */ 0,
&persistentSerialNum)) &persistentTid,
&persistentSerialNum))
{ {
elog(ERROR, elog(ERROR,
"did not find gp_relation_node entry for relation name %s, " "did not find gp_relation_node entry for relation name %s, "
"relation id %u, relfilenode %u", relation->rd_rel->relname.data, "relation id %u, tablespace %u, relfilenode %u",
relation->rd_id, relation->rd_node.relNode); relation->rd_rel->relname.data,
relation->rd_id,
relation->rd_rel->reltablespace,
relation->rd_rel->relfilenode);
} }
if (ItemPointerCompare(&persistentTid, if (ItemPointerCompare(&persistentTid,
......
...@@ -806,10 +806,11 @@ datumstreamwrite_open_file(DatumStreamWrite * ds, char *fn, int64 eof, int64 eof ...@@ -806,10 +806,11 @@ datumstreamwrite_open_file(DatumStreamWrite * ds, char *fn, int64 eof, int64 eof
else else
{ {
if (!ReadGpRelationNode( if (!ReadGpRelationNode(
relFileNode.relNode, (relFileNode.spcNode == MyDatabaseTableSpace) ? 0:relFileNode.spcNode,
segmentFileNum, relFileNode.relNode,
&persistentTid, segmentFileNum,
&persistentSerialNum)) &persistentTid,
&persistentSerialNum))
{ {
elog(ERROR, "Did not find gp_relation_node entry for relfilenode %u, segment file #%d, logical eof " INT64_FORMAT, elog(ERROR, "Did not find gp_relation_node entry for relfilenode %u, segment file #%d, logical eof " INT64_FORMAT,
relFileNode.relNode, relFileNode.relNode,
......
...@@ -56,6 +56,6 @@ ...@@ -56,6 +56,6 @@
*/ */
/* 3yyymmddN */ /* 3yyymmddN */
#define CATALOG_VERSION_NO 301611021 #define CATALOG_VERSION_NO 301612161
#endif #endif
...@@ -134,6 +134,7 @@ typedef FormData_gp_persistent_relation_node *Form_gp_persistent_relation_node; ...@@ -134,6 +134,7 @@ typedef FormData_gp_persistent_relation_node *Form_gp_persistent_relation_node;
CATALOG(gp_relation_node,5094) BKI_WITHOUT_OIDS CATALOG(gp_relation_node,5094) BKI_WITHOUT_OIDS
{ {
Oid tablespace_oid;
Oid relfilenode_oid; Oid relfilenode_oid;
int4 segment_file_num; int4 segment_file_num;
int8 create_mirror_data_loss_tracking_session_num; int8 create_mirror_data_loss_tracking_session_num;
...@@ -141,16 +142,14 @@ CATALOG(gp_relation_node,5094) BKI_WITHOUT_OIDS ...@@ -141,16 +142,14 @@ CATALOG(gp_relation_node,5094) BKI_WITHOUT_OIDS
int8 persistent_serial_num; int8 persistent_serial_num;
} FormData_gp_relation_node; } FormData_gp_relation_node;
/* GPDB added foreign key definitions for gpcheckcat. */ #define Natts_gp_relation_node 6
FOREIGN_KEY(relfilenode_oid REFERENCES pg_class(oid)); #define Anum_gp_relation_node_tablespace_oid 1
#define Anum_gp_relation_node_relfilenode_oid 2
#define Anum_gp_relation_node_segment_file_num 3
#define Anum_gp_relation_node_create_mirror_data_loss_tracking_session_num 4
#define Anum_gp_relation_node_persistent_tid 5
#define Anum_gp_relation_node_persistent_serial_num 6
#define Natts_gp_relation_node 5
#define Anum_gp_relation_node_relfilenode_oid 1
#define Anum_gp_relation_node_segment_file_num 2
#define Anum_gp_relation_node_create_mirror_data_loss_tracking_session_num 3
#define Anum_gp_relation_node_persistent_tid 4
#define Anum_gp_relation_node_persistent_serial_num 5
typedef FormData_gp_relation_node *Form_gp_relation_node; typedef FormData_gp_relation_node *Form_gp_relation_node;
/* /*
...@@ -160,11 +159,12 @@ typedef FormData_gp_relation_node *Form_gp_relation_node; ...@@ -160,11 +159,12 @@ typedef FormData_gp_relation_node *Form_gp_relation_node;
* pg_attribute.h] * pg_attribute.h]
*/ */
#define Schema_gp_relation_node \ #define Schema_gp_relation_node \
{ GpRelationNodeRelationId, {"relfilenode_oid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { GpRelationNodeRelationId, {"tablespace_oid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
{ GpRelationNodeRelationId, {"segment_file_num"}, 23, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \ { GpRelationNodeRelationId, {"relfilenode_oid"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
{ GpRelationNodeRelationId, {"create_mirror_data_loss_tracking_session_num"}, 20, -1, 8, 3, 0, -1, -1, true, 'p', 'd', true, false, false, true, 0 }, \ { GpRelationNodeRelationId, {"segment_file_num"}, 23, -1, 4, 3, 0, -1, -1, true, 'p', 'i', true, false, false, true, 0 }, \
{ GpRelationNodeRelationId, {"persistent_tid"}, 27, -1, 6, 4, 0, -1, -1, false, 'p', 's', true, false, false, true, 0 }, \ { GpRelationNodeRelationId, {"create_mirror_data_loss_tracking_session_num"}, 20, -1, 8, 4, 0, -1, -1, true, 'p', 'd', true, false, false, true, 0 }, \
{ GpRelationNodeRelationId, {"persistent_serial_num"}, 20, -1, 8, 5, 0, -1, -1, true, 'p', 'd', true, false, false, true, 0 } { GpRelationNodeRelationId, {"persistent_tid"}, 27, -1, 6, 5, 0, -1, -1, false, 'p', 's', true, false, false, true, 0 }, \
{ GpRelationNodeRelationId, {"persistent_serial_num"}, 20, -1, 8, 6, 0, -1, -1, true, 'p', 'd', true, false, false, true, 0 }
/* /*
* gp_relation_node table values for FormData_pg_class. * gp_relation_node table values for FormData_pg_class.
...@@ -178,7 +178,7 @@ typedef FormData_gp_relation_node *Form_gp_relation_node; ...@@ -178,7 +178,7 @@ typedef FormData_gp_relation_node *Form_gp_relation_node;
/* /*
* gp_relation_node's index. * gp_relation_node's index.
*/ */
#define Natts_gp_relation_node_index 2 #define Natts_gp_relation_node_index 3
/* /*
* gp_relation_node_index table values for FormData_pg_attribute. * gp_relation_node_index table values for FormData_pg_attribute.
...@@ -187,8 +187,9 @@ typedef FormData_gp_relation_node *Form_gp_relation_node; ...@@ -187,8 +187,9 @@ typedef FormData_gp_relation_node *Form_gp_relation_node;
* pg_attribute.h] * pg_attribute.h]
*/ */
#define Schema_gp_relation_node_index \ #define Schema_gp_relation_node_index \
{ GpRelationNodeRelationId, {"relfilenode_oid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', false, false, false, true, 0 }, \ { GpRelationNodeRelationId, {"tablespace_oid"}, 26, -1, 4, 1, 0, -1, -1, true, 'p', 'i', false, false, false, true, 0 }, \
{ GpRelationNodeRelationId, {"segment_file_num"}, 23, -1, 4, 2, 0, -1, -1, true, 'p', 'i', false, false, false, true, 0 }, { GpRelationNodeRelationId, {"relfilenode_oid"}, 26, -1, 4, 2, 0, -1, -1, true, 'p', 'i', false, false, false, true, 0 }, \
{ GpRelationNodeRelationId, {"segment_file_num"}, 23, -1, 4, 3, 0, -1, -1, true, 'p', 'i', false, false, false, true, 0 },
/* /*
* gp_relation_node_index index values for FormData_pg_class. * gp_relation_node_index index values for FormData_pg_class.
...@@ -221,10 +222,10 @@ typedef FormData_gp_relation_node *Form_gp_relation_node; ...@@ -221,10 +222,10 @@ typedef FormData_gp_relation_node *Form_gp_relation_node;
GpRelationNodeOidIndexId, GpRelationNodeRelationId, Natts_gp_relation_node_index, true, false, false, true, false, true, {Init_int2vector}, {Init_oidvector}, {Init_oidvector}, {Init_text}, {Init_text} GpRelationNodeOidIndexId, GpRelationNodeRelationId, Natts_gp_relation_node_index, true, false, false, true, false, true, {Init_int2vector}, {Init_oidvector}, {Init_oidvector}, {Init_text}, {Init_text}
#define IndKey_gp_relation_node_index \ #define IndKey_gp_relation_node_index \
1, 2 1, 2, 3
#define IndClass_gp_relation_node_index \ #define IndClass_gp_relation_node_index \
OID_BTREE_OPS_OID, INT4_BTREE_OPS_OID OID_BTREE_OPS_OID, OID_BTREE_OPS_OID, INT4_BTREE_OPS_OID
/* /*
* Defines for gp_persistent_database_node table * Defines for gp_persistent_database_node table
...@@ -613,7 +614,7 @@ extern void GpRelationNode_GetValues( ...@@ -613,7 +614,7 @@ extern void GpRelationNode_GetValues(
extern void GpRelationNode_SetDatumValues( extern void GpRelationNode_SetDatumValues(
Datum *values, Datum *values,
Oid tablespaceOid,
Oid relfilenodeOid, Oid relfilenodeOid,
int32 segmentFileNum, int32 segmentFileNum,
int64 createMirrorDataLossTrackingSessionNum, int64 createMirrorDataLossTrackingSessionNum,
......
...@@ -76,6 +76,7 @@ extern void InsertGpRelationNodeTuple( ...@@ -76,6 +76,7 @@ extern void InsertGpRelationNodeTuple(
Relation gp_relation_node, Relation gp_relation_node,
Oid relationId, Oid relationId,
char *relname, char *relname,
Oid tablespaceOid,
Oid relation, Oid relation,
int32 segmentFileNum, int32 segmentFileNum,
bool updateIndex, bool updateIndex,
...@@ -84,6 +85,7 @@ extern void InsertGpRelationNodeTuple( ...@@ -84,6 +85,7 @@ extern void InsertGpRelationNodeTuple(
extern void UpdateGpRelationNodeTuple( extern void UpdateGpRelationNodeTuple(
Relation gp_relation_node, Relation gp_relation_node,
HeapTuple tuple, HeapTuple tuple,
Oid tablespaceOid,
Oid relation, Oid relation,
int32 segmentFileNum, int32 segmentFileNum,
ItemPointer persistentTid, ItemPointer persistentTid,
......
...@@ -275,7 +275,7 @@ DECLARE_UNIQUE_INDEX(pg_appendonly_relid_index, 5007, on pg_appendonly using btr ...@@ -275,7 +275,7 @@ DECLARE_UNIQUE_INDEX(pg_appendonly_relid_index, 5007, on pg_appendonly using btr
DECLARE_UNIQUE_INDEX(gp_fastsequence_objid_objmod_index, 6067, on gp_fastsequence using btree(objid oid_ops, objmod int8_ops)); DECLARE_UNIQUE_INDEX(gp_fastsequence_objid_objmod_index, 6067, on gp_fastsequence using btree(objid oid_ops, objmod int8_ops));
#define FastSequenceObjidObjmodIndexId 6067 #define FastSequenceObjidObjmodIndexId 6067
DECLARE_UNIQUE_INDEX(gp_relation_node_index, 5095, on gp_relation_node using btree(relfilenode_oid oid_ops, segment_file_num int4_ops)); DECLARE_UNIQUE_INDEX(gp_relation_node_index, 5095, on gp_relation_node using btree(tablespace_oid oid_ops, relfilenode_oid oid_ops, segment_file_num int4_ops));
#define GpRelationNodeOidIndexId 5095 #define GpRelationNodeOidIndexId 5095
/* MPP-6929: metadata tracking */ /* MPP-6929: metadata tracking */
......
...@@ -20,8 +20,9 @@ typedef struct GpRelationNodeScan ...@@ -20,8 +20,9 @@ typedef struct GpRelationNodeScan
{ {
Relation gp_relation_node; Relation gp_relation_node;
Oid relationId; Oid relationId;
Oid tablespaceOid;
Oid relfilenode; Oid relfilenode;
ScanKeyData scankey[1]; ScanKeyData scankey[2];
struct SysScanDescData *scan; struct SysScanDescData *scan;
} GpRelationNodeScan; } GpRelationNodeScan;
...@@ -30,6 +31,7 @@ GpRelationNodeBeginScan( ...@@ -30,6 +31,7 @@ GpRelationNodeBeginScan(
Snapshot snapshot, Snapshot snapshot,
Relation gp_relation_node, Relation gp_relation_node,
Oid relationId, Oid relationId,
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
GpRelationNodeScan *gpRelationNodeScan); GpRelationNodeScan *gpRelationNodeScan);
...@@ -46,11 +48,13 @@ GpRelationNodeEndScan( ...@@ -46,11 +48,13 @@ GpRelationNodeEndScan(
extern HeapTuple FetchGpRelationNodeTuple( extern HeapTuple FetchGpRelationNodeTuple(
Relation gp_relation_node, Relation gp_relation_node,
Oid tablespaceOid,
Oid relationNode, Oid relationNode,
int32 segmentFileNum, int32 segmentFileNum,
ItemPointer persistentTid, ItemPointer persistentTid,
int64 *persistentSerialNum); int64 *persistentSerialNum);
extern bool ReadGpRelationNode( extern bool ReadGpRelationNode(
Oid tablespaceOid,
Oid relfilenode, Oid relfilenode,
int32 segmentFileNum, int32 segmentFileNum,
ItemPointer persistentTid, ItemPointer persistentTid,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册