|
13 | 13 | * |
14 | 14 | * |
15 | 15 | * IDENTIFICATION |
16 | | - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.304 2005/03/16 21:38:05 tgl Exp $ |
| 16 | + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.305 2005/03/20 22:00:52 tgl Exp $ |
17 | 17 | * |
18 | 18 | *------------------------------------------------------------------------- |
19 | 19 | */ |
@@ -1138,16 +1138,6 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt) |
1138 | 1138 | /* Clean pages from vacuum_pages list */ |
1139 | 1139 | vacuum_heap(vacrelstats, onerel, &vacuum_pages); |
1140 | 1140 | } |
1141 | | - else |
1142 | | - { |
1143 | | - /* |
1144 | | - * Flush dirty pages out to disk. We must do this even if we |
1145 | | - * didn't do anything else, because we want to ensure that all |
1146 | | - * tuples have correct on-row commit status on disk (see |
1147 | | - * bufmgr.c's comments for FlushRelationBuffers()). |
1148 | | - */ |
1149 | | - FlushRelationBuffers(onerel, vacrelstats->rel_pages); |
1150 | | - } |
1151 | 1141 | } |
1152 | 1142 |
|
1153 | 1143 | /* update shared free space map with final free space info */ |
@@ -2420,15 +2410,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, |
2420 | 2410 | pfree(Nvacpagelist.pagedesc); |
2421 | 2411 | } |
2422 | 2412 |
|
2423 | | - /* |
2424 | | - * Flush dirty pages out to disk. We do this unconditionally, even if |
2425 | | - * we don't need to truncate, because we want to ensure that all |
2426 | | - * tuples have correct on-row commit status on disk (see bufmgr.c's |
2427 | | - * comments for FlushRelationBuffers()). |
2428 | | - */ |
2429 | | - FlushRelationBuffers(onerel, blkno); |
2430 | | - |
2431 | | - /* truncate relation, if needed */ |
| 2413 | + /* Truncate relation, if needed */ |
2432 | 2414 | if (blkno < nblocks) |
2433 | 2415 | { |
2434 | 2416 | RelationTruncate(onerel, blkno); |
@@ -2818,27 +2800,17 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages) |
2818 | 2800 | } |
2819 | 2801 | } |
2820 | 2802 |
|
2821 | | - /* |
2822 | | - * Flush dirty pages out to disk. We do this unconditionally, even if |
2823 | | - * we don't need to truncate, because we want to ensure that all |
2824 | | - * tuples have correct on-row commit status on disk (see bufmgr.c's |
2825 | | - * comments for FlushRelationBuffers()). |
2826 | | - */ |
| 2803 | + /* Truncate relation if there are some empty end-pages */ |
2827 | 2804 | Assert(vacrelstats->rel_pages >= vacuum_pages->empty_end_pages); |
2828 | | - relblocks = vacrelstats->rel_pages - vacuum_pages->empty_end_pages; |
2829 | | - |
2830 | | - FlushRelationBuffers(onerel, relblocks); |
2831 | | - |
2832 | | - /* truncate relation if there are some empty end-pages */ |
2833 | 2805 | if (vacuum_pages->empty_end_pages > 0) |
2834 | 2806 | { |
| 2807 | + relblocks = vacrelstats->rel_pages - vacuum_pages->empty_end_pages; |
2835 | 2808 | ereport(elevel, |
2836 | 2809 | (errmsg("\"%s\": truncated %u to %u pages", |
2837 | 2810 | RelationGetRelationName(onerel), |
2838 | 2811 | vacrelstats->rel_pages, relblocks))); |
2839 | 2812 | RelationTruncate(onerel, relblocks); |
2840 | | - vacrelstats->rel_pages = relblocks; /* set new number of |
2841 | | - * blocks */ |
| 2813 | + vacrelstats->rel_pages = relblocks; /* set new number of blocks */ |
2842 | 2814 | } |
2843 | 2815 | } |
2844 | 2816 |
|
|
0 commit comments