fix bug about recyclebin and truncate partation table

This commit is contained in:
gentle_hu
2023-06-20 17:56:29 +08:00
parent 15f0936882
commit 2beff64895
3 changed files with 6 additions and 5 deletions

View File

@ -5020,7 +5020,7 @@ RelFileNodeBackend CreateNewRelfilenodePart(Relation parent, Partition part)
part->newcbi = true;
}
partition_create_new_storage(parent, part, newrnode);
partition_create_new_storage(parent, part, newrnode, true);
return newrnode;
}

View File

@ -878,7 +878,8 @@ void smgrmovebuckets(SMgrRelation reln1, SMgrRelation reln2, List *bList)
(*(smgrsw[reln1->smgr_which].smgr_move_buckets))(reln1->smgr_rnode, reln2->smgr_rnode, bList);
}
void partition_create_new_storage(Relation rel, Partition part, const RelFileNodeBackend &filenode)
void partition_create_new_storage(Relation rel, Partition part, const RelFileNodeBackend &filenode,
bool keep_old_relfilenode)
{
if (RelationIsCrossBucketIndex(rel) || IsCreatingCrossBucketIndex(part)) {
RelationData dummyrel;
@ -894,8 +895,7 @@ void partition_create_new_storage(Relation rel, Partition part, const RelFileNod
/*
* Schedule unlinking of the old storage at transaction commit.
*/
if (!u_sess->attr.attr_storage.enable_recyclebin ||
!RelationIsTableAccessMethodUStoreType(rel->rd_options)) {
if (!keep_old_relfilenode) {
PartitionDropStorage(rel, part);
}
}

View File

@ -245,7 +245,8 @@ extern Datum smgrin(PG_FUNCTION_ARGS);
extern Datum smgreq(PG_FUNCTION_ARGS);
extern Datum smgrne(PG_FUNCTION_ARGS);
extern void partition_create_new_storage(Relation rel, Partition part, const RelFileNodeBackend& filenode);
extern void partition_create_new_storage(Relation rel, Partition part, const RelFileNodeBackend& filenode,
bool keep_old_relfilenode = false);
extern ScalarToDatum GetTransferFuncByTypeOid(Oid attTypeOid);
extern bool check_unlink_rel_hashtbl(RelFileNode rnode, ForkNumber forknum);