forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4de6024
committed
Fix missing call to table_finish_bulk_insert during COPY
86b8504 abstracted calls to heap functions in COPY FROM to support ageneric table AM. However, when performing a copy into a partitionedtable, this commit neglected to call table_finish_bulk_insert for eachpartition. Before86b8504, when we always called the heap functions,there was no need to call heapam_finish_bulk_insert for partitions sinceit only did any work when performing a copy without WAL. For partitionedtables, this was unsupported anyway, so there was no issue. With pluggablestorage, we can't make any assumptions about what the table AM might wantto do in its equivalent function, so we'd better ensure we always calltable_finish_bulk_insert each partition that's received a row.For now, we make the table_finish_bulk_insert call whenever we evict aCopyMultiInsertBuffer out of the CopyMultiInsertInfo. This does meanthat it's possible that we call table_finish_bulk_insert multiple timesper partition, which is not a problem other than being an inefficiency.Improving this requires a more invasive patch, so let's leave that foranother day.In passing, move the table_finish_bulk_insert for the target of the COPYcommand so that it's only called when we're actually performing bulkinserts. We don't need to call this when inserting 1 row at a time.Reported-by: Robert HaasDiscussion:https://postgr.es/m/CA+TgmoYK=6BpxiJ0tN-p9wtH0BTAfbdxzHhwou0mdud4+BkYuQ@mail.gmail.com1 parent95bbe5d commit4de6024
1 file changed
+14
-7
lines changedLines changed: 14 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2518 | 2518 |
| |
2519 | 2519 |
| |
2520 | 2520 |
| |
2521 |
| - | |
| 2521 | + | |
| 2522 | + | |
2522 | 2523 |
| |
2523 | 2524 |
| |
2524 | 2525 |
| |
| |||
2534 | 2535 |
| |
2535 | 2536 |
| |
2536 | 2537 |
| |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
2537 | 2541 |
| |
2538 | 2542 |
| |
2539 | 2543 |
| |
| |||
2585 | 2589 |
| |
2586 | 2590 |
| |
2587 | 2591 |
| |
2588 |
| - | |
| 2592 | + | |
2589 | 2593 |
| |
2590 | 2594 |
| |
2591 | 2595 |
| |
| |||
2599 | 2603 |
| |
2600 | 2604 |
| |
2601 | 2605 |
| |
2602 |
| - | |
| 2606 | + | |
2603 | 2607 |
| |
2604 | 2608 |
| |
2605 | 2609 |
| |
| |||
3321 | 3325 |
| |
3322 | 3326 |
| |
3323 | 3327 |
| |
3324 |
| - | |
3325 |
| - | |
3326 |
| - | |
3327 | 3328 |
| |
3328 | 3329 |
| |
3329 | 3330 |
| |
| |||
3366 | 3367 |
| |
3367 | 3368 |
| |
3368 | 3369 |
| |
3369 |
| - | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
3370 | 3377 |
| |
3371 | 3378 |
| |
3372 | 3379 |
| |
|
0 commit comments
Comments
(0)