automatic_restore_point_v2.patch
application/octet-stream
Filename: automatic_restore_point_v2.patch
Type: application/octet-stream
Part: 0
Message:
RE: automatic restore point
Patch
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlog.c | 1 | 0 |
| src/backend/tcop/utility.c | 8 | 0 |
| src/backend/utils/misc/guc.c | 9 | 0 |
| src/backend/utils/misc/postgresql.conf.sample | 1 | 0 |
| src/include/access/xlog.h | 1 | 0 |
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c633e11..5da8b57 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -100,6 +100,7 @@ bool wal_compression = false;
char *wal_consistency_checking_string = NULL;
bool *wal_consistency_checking = NULL;
bool log_checkpoints = false;
+bool log_recovery_points = false;
int sync_method = DEFAULT_SYNC_METHOD;
int wal_level = WAL_LEVEL_MINIMAL;
int CommitDelay = 0; /* precommit delay in microseconds */
diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c
index bdfb66f..e6cf576 100644
--- a/src/backend/tcop/utility.c
+++ b/src/backend/tcop/utility.c
@@ -86,6 +86,8 @@ static void ProcessUtilitySlow(ParseState *pstate,
char *completionTag);
static void ExecDropStmt(DropStmt *stmt, bool isTopLevel);
+bool Log_recovery_points = false;
+
/*
* CommandIsReadOnly: is an executable query read-only?
@@ -538,6 +540,9 @@ standard_ProcessUtility(PlannedStmt *pstmt,
break;
case T_TruncateStmt:
+ if (log_recovery_points)
+ ereport(LOG,
+ (errmsg("recovery_point_lsn: 0/%X", (int) ProcLastRecPtr)));
ExecuteTruncate((TruncateStmt *) parsetree);
break;
@@ -1718,6 +1723,9 @@ ExecDropStmt(DropStmt *stmt, bool isTopLevel)
/* fall through */
case OBJECT_TABLE:
+ if (log_recovery_points)
+ ereport(LOG,
+ (errmsg("recovery_point_lsn: 0/%X", (int) ProcLastRecPtr)));
case OBJECT_SEQUENCE:
case OBJECT_VIEW:
case OBJECT_MATVIEW:
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 7cd2d2d..fa48393 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1113,6 +1113,15 @@ static struct config_bool ConfigureNamesBool[] =
NULL, NULL, NULL
},
{
+ {"log_recovery_points", PGC_SIGHUP, LOGGING_WHAT,
+ gettext_noop("Logs each LSN."),
+ NULL
+ },
+ &log_recovery_points,
+ false,
+ NULL, NULL, NULL
+ },
+ {
{"log_connections", PGC_SU_BACKEND, LOGGING_WHAT,
gettext_noop("Logs each successful connection."),
NULL
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 3d88e80..c3f25c3 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -455,6 +455,7 @@
#debug_print_plan = off
#debug_pretty_print = on
#log_checkpoints = off
+#log_recovery_points = off
#log_connections = off
#log_disconnections = off
#log_duration = off
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index 421ba6d..5420e84 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -109,6 +109,7 @@ extern bool wal_compression;
extern bool *wal_consistency_checking;
extern char *wal_consistency_checking_string;
extern bool log_checkpoints;
+extern bool log_recovery_points;
extern int CheckPointSegments;