Compare commits

...

10 Commits

Author SHA1 Message Date
Konstantin Knizhnik
f992cfe86f Call AtEOXact_SMgr at end of page redo 2025-03-02 17:01:40 +02:00
Konstantin Knizhnik
6d82eddecb Close relation in walredo 2025-03-02 09:17:28 +02:00
Konstantin Knizhnik
a25813b8a6 Reset local relation cache in walredo 2025-03-01 22:05:03 +02:00
Konstantin Knizhnik
3a8f50c6c8 Fix indentation 2025-02-27 07:50:44 +02:00
Konstantin Knizhnik
51f16af1ac Ignore LOG message of walredo process at PS 2025-02-26 20:55:02 +02:00
Konstantin Knizhnik
9e4a223413 Set log_min_messages to WARNING for walredo process 2025-02-26 16:18:54 +02:00
Konstantin Knizhnik
ef55ee0e6c Set log_min_messages to WARNING for walredo process 2025-02-26 16:18:30 +02:00
Konstantin Knizhnik
adfd4b1836 Print stack trace when number of writtern pages during walredo exceeds 32 2025-02-25 13:40:44 +02:00
Konstantin Knizhnik
0ee2b646ab Allow futex syscall to enable errbacktrace 2025-02-22 21:06:49 +02:00
Konstantin Knizhnik
212d27f24e Increase inmem SMGR size for walredo process to 100 pagees 2025-02-22 16:00:55 +02:00
3 changed files with 22 additions and 11 deletions

View File

@@ -136,7 +136,9 @@ impl WalRedoProcess {
Ok(0) => break Ok(()), // eof
Ok(num_bytes) => {
let output = String::from_utf8_lossy(&buf[..num_bytes]);
error!(%output, "received output");
if !output.contains("LOG:") {
error!(%output, "received output");
}
}
Err(e) => {
break Err(e);

View File

@@ -32,8 +32,8 @@
#include "inmem_smgr.h"
/* Size of the in-memory smgr */
#define MAX_PAGES 64
/* Size of the in-memory smgr: XLR_MAX_BLOCK_ID is 32, but we can update up to 3 forks for each block */
#define MAX_PAGES 100
/* If more than WARN_PAGES are used, print a warning in the log */
#define WARN_PAGES 32
@@ -285,12 +285,12 @@ inmem_write(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
* WARN_PAGES, print a warning so that we get alerted and get to
* investigate why we're accessing so many buffers.
*/
elog(used_pages >= WARN_PAGES ? WARNING : DEBUG1,
"inmem_write() called for %u/%u/%u.%u blk %u: used_pages %u",
RelFileInfoFmt(InfoFromSMgrRel(reln)),
forknum,
blocknum,
used_pages);
if (used_pages >= WARN_PAGES)
ereport(WARNING, (errmsg("inmem_write() called for %u/%u/%u.%u blk %u: used_pages %u",
RelFileInfoFmt(InfoFromSMgrRel(reln)),
forknum,
blocknum,
used_pages), errbacktrace()));
if (used_pages == MAX_PAGES)
elog(ERROR, "Inmem storage overflow");

View File

@@ -142,7 +142,7 @@ static BufferTag target_redo_tag;
static XLogReaderState *reader_state;
#define TRACE LOG
#define TRACE DEBUG1
#ifdef HAVE_LIBSECCOMP
@@ -194,6 +194,7 @@ static PgSeccompRule allowed_syscalls[] =
* is stored in MyProcPid anyway.
*/
PG_SCMP_ALLOW(getpid),
PG_SCMP_ALLOW(futex), /* needed for errbacktrace */
/* Enable those for a proper shutdown. */
#if 0
@@ -253,7 +254,7 @@ WalRedoMain(int argc, char *argv[])
* which is super strange but that's not something we can solve
* for here. ¯\_(-_-)_/¯
*/
SetConfigOption("log_min_messages", "FATAL", PGC_SUSET, PGC_S_OVERRIDE);
SetConfigOption("log_min_messages", "WARNING", PGC_SUSET, PGC_S_OVERRIDE);
SetConfigOption("client_min_messages", "ERROR", PGC_SUSET,
PGC_S_OVERRIDE);
@@ -758,6 +759,11 @@ BeginRedoForBlock(StringInfo input_message)
{
reln->smgr_cached_nblocks[forknum] = blknum + 1;
}
if (target_redo_tag.forkNum == MAIN_FORKNUM)
{
reln->smgr_cached_nblocks[FSM_FORKNUM] = MaxBlockNumber;
reln->smgr_cached_nblocks[VISIBILITYMAP_FORKNUM] = MaxBlockNumber;
}
}
/*
@@ -1053,6 +1059,9 @@ GetPage(StringInfo input_message)
DropRelationAllLocalBuffers(rinfo);
wal_redo_buffer = InvalidBuffer;
/* Remove relation from SMGR relastion cache */
AtEOXact_SMgr();
elog(TRACE, "Page sent back for block %u", blknum);
}