debug-clog-r02.diff

text/plain

Filename: debug-clog-r02.diff
Type: text/plain
Part: 0
Message: clog_redo causing very long recovery time

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/access/transam/clog.c 4 0
src/backend/access/transam/varsup.c 6 0
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 52224b1..317bc2e 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -36,6 +36,7 @@
 #include "access/slru.h"
 #include "access/transam.h"
 #include "postmaster/bgwriter.h"
+#include "utils/guc.h"
 
 /*
  * Defines for CLOG page sizes.  A page is the same BLCKSZ as is used
@@ -355,6 +356,9 @@ ExtendCLOG(TransactionId newestXact)
 	/* Zero the page and make an XLOG entry about it */
 	ZeroCLOGPage(pageno, true);
 
+	/* steal this variable for test -- means we've been here */
+	Debug_print_rewritten = true;
+
 	LWLockRelease(CLogControlLock);
 }
 
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 8838d42..e55a67b 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -21,6 +21,7 @@
 #include "storage/pmsignal.h"
 #include "storage/proc.h"
 #include "utils/builtins.h"
+#include "utils/guc.h"
 
 
 /* Number of OIDs to prefetch (preallocate) per XLOG write */
@@ -107,6 +108,11 @@ GetNewTransactionId(bool isSubXact)
 	 * Extend pg_subtrans too.
 	 */
 	ExtendCLOG(xid);
+	if (Debug_print_rewritten && Debug_pretty_print)
+	{
+		Debug_print_rewritten = false;
+		elog(ERROR,"injected ERROR");
+	}
 	ExtendSUBTRANS(xid);
 
 	/*