summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera2021-11-22 16:43:43 +0000
committerAlvaro Herrera2021-11-22 16:43:43 +0000
commit2fed48f48f7f2f7a6d6f6d020f046efe3c249828 (patch)
treeff31f390721e3f290f321a796b54963ec8b39e18
parent042412879e35791a65509f2786b4954a273466e5 (diff)
Be more specific about OOM in XLogReaderAllocate
A couple of spots can benefit from an added errdetail(), which matches what we were already doing in other places; and those that cannot withstand errdetail() can get a more descriptive primary message. Author: Bharath Rupireddy <[email protected]> Reviewed-by: Daniel Gustafsson <[email protected]> Reviewed-by: Julien Rouhaud <[email protected]> Discussion: https://postgr.es/m/CALj2ACV+cX1eM03GfcA=ZMLXh5fSn1X1auJLz3yuS1duPSb9QA@mail.gmail.com
-rw-r--r--src/backend/access/transam/xlog.c2
-rw-r--r--src/backend/replication/logical/logical.c3
-rw-r--r--src/backend/replication/walsender.c3
-rw-r--r--src/bin/pg_rewind/parsexlog.c6
-rw-r--r--src/bin/pg_waldump/pg_waldump.c2
5 files changed, 9 insertions, 7 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 33bb0229aa7..221e4cb34f8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -1265,7 +1265,7 @@ XLogInsertRecord(XLogRecData *rdata,
if (!debug_reader)
{
- appendStringInfoString(&buf, "error decoding record: out of memory");
+ appendStringInfoString(&buf, "error decoding record: out of memory while allocating a WAL reading processor");
}
else if (!DecodeXLogRecord(debug_reader, (XLogRecord *) recordBuf.data,
&errormsg))
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c
index b7d95215764..10cbdea124c 100644
--- a/src/backend/replication/logical/logical.c
+++ b/src/backend/replication/logical/logical.c
@@ -202,7 +202,8 @@ StartupDecodingContext(List *output_plugin_options,
if (!ctx->reader)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
+ errmsg("out of memory"),
+ errdetail("Failed while allocating a WAL reading processor.")));
ctx->reorder = ReorderBufferAllocate();
ctx->snapshot_builder =
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 7950afb173c..84915ed95bd 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -681,7 +681,8 @@ StartReplication(StartReplicationCmd *cmd)
if (!xlogreader)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
- errmsg("out of memory")));
+ errmsg("out of memory"),
+ errdetail("Failed while allocating a WAL reading processor.")));
/*
* We assume here that we're logging enough information in the WAL for
diff --git a/src/bin/pg_rewind/parsexlog.c b/src/bin/pg_rewind/parsexlog.c
index 59ebac7d6aa..436df541201 100644
--- a/src/bin/pg_rewind/parsexlog.c
+++ b/src/bin/pg_rewind/parsexlog.c
@@ -74,7 +74,7 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex,
XL_ROUTINE(.page_read = &SimpleXLogPageRead),
&private);
if (xlogreader == NULL)
- pg_fatal("out of memory");
+ pg_fatal("out of memory while allocating a WAL reading processor");
XLogBeginRead(xlogreader, startpoint);
do
@@ -132,7 +132,7 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex,
XL_ROUTINE(.page_read = &SimpleXLogPageRead),
&private);
if (xlogreader == NULL)
- pg_fatal("out of memory");
+ pg_fatal("out of memory while allocating a WAL reading processor");
XLogBeginRead(xlogreader, ptr);
record = XLogReadRecord(xlogreader, &errormsg);
@@ -192,7 +192,7 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, int tliIndex,
XL_ROUTINE(.page_read = &SimpleXLogPageRead),
&private);
if (xlogreader == NULL)
- pg_fatal("out of memory");
+ pg_fatal("out of memory while allocating a WAL reading processor");
searchptr = forkptr;
for (;;)
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index 1e3894b9c45..4690e0f5156 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -1061,7 +1061,7 @@ main(int argc, char **argv)
.segment_close = WALDumpCloseSegment),
&private);
if (!xlogreader_state)
- fatal_error("out of memory");
+ fatal_error("out of memory while allocating a WAL reading processor");
/* first find a valid recptr to start from */
first_record = XLogFindNextRecord(xlogreader_state, private.startptr);