mirror of
https://github.com/postgres/postgres.git
synced 2026-10-23 13:29:09 +03:00
Forbid pg_get_multixact_stats() during recovery
MultiXactState->oldestOffset is not maintained during recovery, so calling pg_get_multixact_stats() in this context would report misleading information. We could try to work this out by adding this field to the control file, for example, but such a change would be too invasive at this stage of the v19 development cycle. The information of pg_get_multixact_stats() is usually useful to control the need of some VACUUM or some freezing, operations that cannot happen on a standby, so the argument to make the function work while recovery is in progress gets thinner with this point in the balance. The function is updated to return an ERROR when called under RecoveryInProgress(). Per discussion with Heikki Linnakangas and Naga Appani. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/CA+QeY+DcnsZRL4GZD8JyJu5HD-d6p8_9M5kT4jgF3gq3Rh8n4w@mail.gmail.com Discussion: https://postgr.es/m/20260827231757.78.noahmisch@microsoft.com Backpatch-through: 19
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "access/htup_details.h"
|
||||
#include "access/multixact.h"
|
||||
#include "access/multixact_internal.h"
|
||||
#include "access/xlog.h"
|
||||
#include "catalog/pg_authid_d.h"
|
||||
#include "funcapi.h"
|
||||
#include "miscadmin.h"
|
||||
@@ -103,6 +104,13 @@ pg_get_multixact_stats(PG_FUNCTION_ARGS)
|
||||
Datum values[4];
|
||||
bool nulls[4];
|
||||
|
||||
if (RecoveryInProgress())
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||
errmsg("recovery is in progress"),
|
||||
errhint("%s cannot be executed during recovery.",
|
||||
"pg_get_multixact_stats()")));
|
||||
|
||||
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
|
||||
Reference in New Issue
Block a user