Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9f35e42

Browse files
committed
Remove unnecessary smgropen() calls
Now that RelationCreateStorage() returns the SmgrRelation (since commit 5c15606), use that. Author: Japin Li Discussion: https://www.postgresql.org/message-id/ME3P282MB316600FA62F6605477F26F6AB6742@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
1 parent 5fce30e commit 9f35e42

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/backend/access/heap/heapam_handler.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -633,8 +633,6 @@ heapam_relation_copy_data(Relation rel, const RelFileLocator *newrlocator)
633633
{
634634
SMgrRelation dstrel;
635635

636-
dstrel = smgropen(*newrlocator, rel->rd_backend);
637-
638636
/*
639637
* Since we copy the file directly without looking at the shared buffers,
640638
* we'd better first flush out any pages of the source relation that are
@@ -650,7 +648,7 @@ heapam_relation_copy_data(Relation rel, const RelFileLocator *newrlocator)
650648
* NOTE: any conflict in relfilenumber value will be caught in
651649
* RelationCreateStorage().
652650
*/
653-
RelationCreateStorage(*newrlocator, rel->rd_rel->relpersistence, true);
651+
dstrel = RelationCreateStorage(*newrlocator, rel->rd_rel->relpersistence, true);
654652

655653
/* copy main fork */
656654
RelationCopyStorage(RelationGetSmgr(rel), dstrel, MAIN_FORKNUM,

src/backend/commands/tablecmds.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -15747,8 +15747,6 @@ index_copy_data(Relation rel, RelFileLocator newrlocator)
1574715747
{
1574815748
SMgrRelation dstrel;
1574915749

15750-
dstrel = smgropen(newrlocator, rel->rd_backend);
15751-
1575215750
/*
1575315751
* Since we copy the file directly without looking at the shared buffers,
1575415752
* we'd better first flush out any pages of the source relation that are
@@ -15764,7 +15762,7 @@ index_copy_data(Relation rel, RelFileLocator newrlocator)
1576415762
* NOTE: any conflict in relfilenumber value will be caught in
1576515763
* RelationCreateStorage().
1576615764
*/
15767-
RelationCreateStorage(newrlocator, rel->rd_rel->relpersistence, true);
15765+
dstrel = RelationCreateStorage(newrlocator, rel->rd_rel->relpersistence, true);
1576815766

1576915767
/* copy main fork */
1577015768
RelationCopyStorage(RelationGetSmgr(rel), dstrel, MAIN_FORKNUM,

0 commit comments

Comments
 (0)