diff options
| author | Tom Lane | 2004-05-31 19:24:05 +0000 |
|---|---|---|
| committer | Tom Lane | 2004-05-31 19:24:05 +0000 |
| commit | e674707968059459960304981fc0a1d7a6049e24 (patch) | |
| tree | f276eafb51fa96700fd49a3e7bb309516fbec280 /src/backend/commands | |
| parent | a843053e2e596da640d2afc73eeaa1f9273fff38 (diff) | |
Minor code rationalization: FlushRelationBuffers just returns void,
rather than an error code, and does elog(ERROR) not elog(WARNING)
when it detects a problem. All callers were simply elog(ERROR)'ing on
failure return anyway, and I find it hard to envision a caller that would
not, so we may as well simplify the callers and produce the more useful
error message directly.
Diffstat (limited to 'src/backend/commands')
| -rw-r--r-- | src/backend/commands/cluster.c | 11 | ||||
| -rw-r--r-- | src/backend/commands/vacuum.c | 14 | ||||
| -rw-r--r-- | src/backend/commands/vacuumlazy.c | 6 |
3 files changed, 9 insertions, 22 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index d9c4397176..0483eaf2d3 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.124 2004/05/26 04:41:10 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.125 2004/05/31 19:24:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -660,7 +660,6 @@ swap_relfilenodes(Oid r1, Oid r2) Form_pg_class relform1, relform2; Oid swaptemp; - int i; CatalogIndexState indstate; /* We need writable copies of both pg_class tuples. */ @@ -687,15 +686,11 @@ swap_relfilenodes(Oid r1, Oid r2) * forget about'em. (XXX this might not be necessary anymore?) */ rel = relation_open(r1, NoLock); - i = FlushRelationBuffers(rel, 0); - if (i < 0) - elog(ERROR, "FlushRelationBuffers returned %d", i); + FlushRelationBuffers(rel, 0); relation_close(rel, NoLock); rel = relation_open(r2, NoLock); - i = FlushRelationBuffers(rel, 0); - if (i < 0) - elog(ERROR, "FlushRelationBuffers returned %d", i); + FlushRelationBuffers(rel, 0); relation_close(rel, NoLock); /* diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index b2ebda8e97..aa6491af1c 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.278 2004/05/26 04:41:12 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.279 2004/05/31 19:24:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1031,9 +1031,7 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt) * tuples have correct on-row commit status on disk (see * bufmgr.c's comments for FlushRelationBuffers()). */ - i = FlushRelationBuffers(onerel, vacrelstats->rel_pages); - if (i < 0) - elog(ERROR, "FlushRelationBuffers returned %d", i); + FlushRelationBuffers(onerel, vacrelstats->rel_pages); } } @@ -2542,9 +2540,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, * tuples have correct on-row commit status on disk (see bufmgr.c's * comments for FlushRelationBuffers()). */ - i = FlushRelationBuffers(onerel, blkno); - if (i < 0) - elog(ERROR, "FlushRelationBuffers returned %d", i); + FlushRelationBuffers(onerel, blkno); /* truncate relation, if needed */ if (blkno < nblocks) @@ -2606,9 +2602,7 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages) Assert(vacrelstats->rel_pages >= vacuum_pages->empty_end_pages); relblocks = vacrelstats->rel_pages - vacuum_pages->empty_end_pages; - i = FlushRelationBuffers(onerel, relblocks); - if (i < 0) - elog(ERROR, "FlushRelationBuffers returned %d", i); + FlushRelationBuffers(onerel, relblocks); /* truncate relation if there are some empty end-pages */ if (vacuum_pages->empty_end_pages > 0) diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c index af1b646be4..f67c1c76fe 100644 --- a/src/backend/commands/vacuumlazy.c +++ b/src/backend/commands/vacuumlazy.c @@ -31,7 +31,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.40 2004/05/08 19:09:25 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.41 2004/05/31 19:24:05 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -731,9 +731,7 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats) * will also write out dirty buffers for blocks we aren't deleting, * but it's the closest thing in bufmgr's API. */ - i = FlushRelationBuffers(onerel, new_rel_pages); - if (i < 0) - elog(ERROR, "FlushRelationBuffers returned %d", i); + FlushRelationBuffers(onerel, new_rel_pages); /* * Do the physical truncation. |
