aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/file/fd.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-06-06 17:07:46 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-06-06 17:07:46 +0000
commit1173344e74f7b0eccb9bf3ad2307c82e12cb4fd8 (patch)
tree00c3aef112f9552cca8be339a7119d0541d73578 /src/backend/storage/file/fd.c
parentce370eec3555a48c05154fa2e3f102af9c851e1e (diff)
downloadpostgresql-1173344e74f7b0eccb9bf3ad2307c82e12cb4fd8.tar.gz
postgresql-1173344e74f7b0eccb9bf3ad2307c82e12cb4fd8.zip
Adjust WAL code so that checkpoints truncate the xlog at the previous
checkpoint's redo pointer, not its undo pointer, per discussion in pghackers a few days ago. No point in hanging onto undo information until we have the ability to do something with it --- and this solves a rather large problem with log space for long-running transactions. Also, change all calls of write() to detect the case where write returned a count less than requested, but failed to set errno. Presume that this situation indicates ENOSPC, and give the appropriate error message, rather than a random message associated with the previous value of errno.
Diffstat (limited to 'src/backend/storage/file/fd.c')
-rw-r--r--src/backend/storage/file/fd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index 06ee4bc2729..237ae0a4428 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.79 2001/05/30 14:15:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/storage/file/fd.c,v 1.80 2001/06/06 17:07:46 tgl Exp $
*
* NOTES:
*
@@ -865,7 +865,14 @@ FileWrite(File file, char *buffer, int amount)
VfdCache[file].seekPos, amount, buffer));
FileAccess(file);
+
+ errno = 0;
returnCode = write(VfdCache[file].fd, buffer, amount);
+
+ /* if write didn't set errno, assume problem is no disk space */
+ if (returnCode != amount && errno == 0)
+ errno = ENOSPC;
+
if (returnCode > 0)
VfdCache[file].seekPos += returnCode;
else