Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2fed48f

Browse files
committed
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 <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Discussion: https://postgr.es/m/CALj2ACV+cX1eM03GfcA=ZMLXh5fSn1X1auJLz3yuS1duPSb9QA@mail.gmail.com
1 parent 0424128 commit 2fed48f

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

src/backend/access/transam/xlog.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ XLogInsertRecord(XLogRecData *rdata,
12651265

12661266
if (!debug_reader)
12671267
{
1268-
appendStringInfoString(&buf, "error decoding record: out of memory");
1268+
appendStringInfoString(&buf, "error decoding record: out of memory while allocating a WAL reading processor");
12691269
}
12701270
else if (!DecodeXLogRecord(debug_reader, (XLogRecord *) recordBuf.data,
12711271
&errormsg))

src/backend/replication/logical/logical.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ StartupDecodingContext(List *output_plugin_options,
202202
if (!ctx->reader)
203203
ereport(ERROR,
204204
(errcode(ERRCODE_OUT_OF_MEMORY),
205-
errmsg("out of memory")));
205+
errmsg("out of memory"),
206+
errdetail("Failed while allocating a WAL reading processor.")));
206207

207208
ctx->reorder = ReorderBufferAllocate();
208209
ctx->snapshot_builder =

src/backend/replication/walsender.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,8 @@ StartReplication(StartReplicationCmd *cmd)
681681
if (!xlogreader)
682682
ereport(ERROR,
683683
(errcode(ERRCODE_OUT_OF_MEMORY),
684-
errmsg("out of memory")));
684+
errmsg("out of memory"),
685+
errdetail("Failed while allocating a WAL reading processor.")));
685686

686687
/*
687688
* We assume here that we're logging enough information in the WAL for

src/bin/pg_rewind/parsexlog.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex,
7474
XL_ROUTINE(.page_read = &SimpleXLogPageRead),
7575
&private);
7676
if (xlogreader == NULL)
77-
pg_fatal("out of memory");
77+
pg_fatal("out of memory while allocating a WAL reading processor");
7878

7979
XLogBeginRead(xlogreader, startpoint);
8080
do
@@ -132,7 +132,7 @@ readOneRecord(const char *datadir, XLogRecPtr ptr, int tliIndex,
132132
XL_ROUTINE(.page_read = &SimpleXLogPageRead),
133133
&private);
134134
if (xlogreader == NULL)
135-
pg_fatal("out of memory");
135+
pg_fatal("out of memory while allocating a WAL reading processor");
136136

137137
XLogBeginRead(xlogreader, ptr);
138138
record = XLogReadRecord(xlogreader, &errormsg);
@@ -192,7 +192,7 @@ findLastCheckpoint(const char *datadir, XLogRecPtr forkptr, int tliIndex,
192192
XL_ROUTINE(.page_read = &SimpleXLogPageRead),
193193
&private);
194194
if (xlogreader == NULL)
195-
pg_fatal("out of memory");
195+
pg_fatal("out of memory while allocating a WAL reading processor");
196196

197197
searchptr = forkptr;
198198
for (;;)

src/bin/pg_waldump/pg_waldump.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ main(int argc, char **argv)
10611061
.segment_close = WALDumpCloseSegment),
10621062
&private);
10631063
if (!xlogreader_state)
1064-
fatal_error("out of memory");
1064+
fatal_error("out of memory while allocating a WAL reading processor");
10651065

10661066
/* first find a valid recptr to start from */
10671067
first_record = XLogFindNextRecord(xlogreader_state, private.startptr);

0 commit comments

Comments
 (0)