Commit 9e95c9ad authored by Simon Riggs's avatar Simon Riggs

Create new errcode for recovery conflict caused by db drop on master.

Previously reported as ERRCODE_ADMIN_SHUTDOWN, this case is now
reported as ERRCODE_T_R_DATABASE_DROPPED. No message text change.
Unlikely to happen on most servers, so low impact change to allow
session poolers to correctly handle this situation.

Tatsuo Ishii, edits by me, review by Robert Haas
parent 44df84df
...@@ -985,6 +985,11 @@ ...@@ -985,6 +985,11 @@
<entry>deadlock_detected</entry> <entry>deadlock_detected</entry>
</row> </row>
<row>
<entry><literal>40P02</literal></entry>
<entry>DATABASE DROPPED</entry>
<entry>database_dropped</entry>
</row>
<row> <row>
<entry spanname="span13"><emphasis role="bold">Class 42 &mdash; Syntax Error or Access Rule Violation</></entry> <entry spanname="span13"><emphasis role="bold">Class 42 &mdash; Syntax Error or Access Rule Violation</></entry>
......
...@@ -2912,9 +2912,11 @@ ProcessInterrupts(void) ...@@ -2912,9 +2912,11 @@ ProcessInterrupts(void)
} }
else if (RecoveryConflictPending) else if (RecoveryConflictPending)
{ {
/* Currently there is only one non-retryable recovery conflict */
Assert(RecoveryConflictReason == PROCSIG_RECOVERY_CONFLICT_DATABASE);
pgstat_report_recovery_conflict(RecoveryConflictReason); pgstat_report_recovery_conflict(RecoveryConflictReason);
ereport(FATAL, ereport(FATAL,
(errcode(ERRCODE_ADMIN_SHUTDOWN), (errcode(ERRCODE_T_R_DATABASE_DROPPED),
errmsg("terminating connection due to conflict with recovery"), errmsg("terminating connection due to conflict with recovery"),
errdetail_recovery_conflict())); errdetail_recovery_conflict()));
} }
......
...@@ -243,6 +243,7 @@ ...@@ -243,6 +243,7 @@
#define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0', '0','0','1') #define ERRCODE_T_R_SERIALIZATION_FAILURE MAKE_SQLSTATE('4','0', '0','0','1')
#define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0', '0','0','3') #define ERRCODE_T_R_STATEMENT_COMPLETION_UNKNOWN MAKE_SQLSTATE('4','0', '0','0','3')
#define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0', 'P','0','1') #define ERRCODE_T_R_DEADLOCK_DETECTED MAKE_SQLSTATE('4','0', 'P','0','1')
#define ERRCODE_T_R_DATABASE_DROPPED MAKE_SQLSTATE('4','0', 'P','0','2')
/* Class 42 - Syntax Error or Access Rule Violation */ /* Class 42 - Syntax Error or Access Rule Violation */
#define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2', '0','0','0') #define ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION MAKE_SQLSTATE('4','2', '0','0','0')
......
...@@ -483,6 +483,10 @@ ...@@ -483,6 +483,10 @@
"deadlock_detected", ERRCODE_T_R_DEADLOCK_DETECTED "deadlock_detected", ERRCODE_T_R_DEADLOCK_DETECTED
}, },
{
"database_dropped", ERRCODE_T_R_DATABASE_DROPPED
},
{ {
"syntax_error_or_access_rule_violation", ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION "syntax_error_or_access_rule_violation", ERRCODE_SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment