fix bug about recyclebin and truncate partation table
This commit is contained in:
2
src/common/backend/utils/cache/relcache.cpp
vendored
2
src/common/backend/utils/cache/relcache.cpp
vendored
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user