Fail BRIN control functions during recovery explicitly
They already fail anyway, but prior to this patch they raise an ugly error message about a lock that cannot be acquired. This just improves the message. Author: Masahiko Sawada Reported-by: Masahiko Sawada Discussion: https://postgr.es/m/CAD21AoBZau4g4_NUf3BKNd=CdYK+xaPdtJCzvOC1TxGdTiJx_Q@mail.gmail.com Reviewed-by: Kuntal Ghosh, Alexander Korotkov, Simon Riggs, Michaël Paquier, Álvaro Herrera
This commit is contained in:
parent
14b3ec6f30
commit
2dbcf515ae
@ -20,6 +20,7 @@
|
|||||||
#include "access/brin_page.h"
|
#include "access/brin_page.h"
|
||||||
#include "access/brin_pageops.h"
|
#include "access/brin_pageops.h"
|
||||||
#include "access/brin_xlog.h"
|
#include "access/brin_xlog.h"
|
||||||
|
#include "access/xlog.h"
|
||||||
#include "access/reloptions.h"
|
#include "access/reloptions.h"
|
||||||
#include "access/relscan.h"
|
#include "access/relscan.h"
|
||||||
#include "access/xact.h"
|
#include "access/xact.h"
|
||||||
@ -792,6 +793,12 @@ brin_summarize_new_values(PG_FUNCTION_ARGS)
|
|||||||
Relation heapRel;
|
Relation heapRel;
|
||||||
double numSummarized = 0;
|
double numSummarized = 0;
|
||||||
|
|
||||||
|
if (RecoveryInProgress())
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
|
||||||
|
errmsg("recovery is in progress"),
|
||||||
|
errhint("BRIN control functions cannot be executed during recovery.")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must lock table before index to avoid deadlocks. However, if the
|
* We must lock table before index to avoid deadlocks. However, if the
|
||||||
* passed indexoid isn't an index then IndexGetRelation() will fail.
|
* passed indexoid isn't an index then IndexGetRelation() will fail.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user