|
18 | 18 | #include <unistd.h>
|
19 | 19 |
|
20 | 20 | #include "access/xlog.h"
|
| 21 | +#include "access/xlogrecovery.h" |
21 | 22 | #include "common/ip.h"
|
22 | 23 | #include "common/string.h"
|
23 | 24 | #include "libpq/libpq.h"
|
@@ -306,17 +307,24 @@ BackendInitialize(ClientSocket *client_sock, CAC_state cac)
|
306 | 307 | (errcode(ERRCODE_CANNOT_CONNECT_NOW),
|
307 | 308 | errmsg("the database system is starting up")));
|
308 | 309 | break;
|
309 |
| - case CAC_NOTCONSISTENT: |
310 |
| - if (EnableHotStandby) |
| 310 | + case CAC_NOTHOTSTANDBY: |
| 311 | + if (!EnableHotStandby) |
| 312 | + ereport(FATAL, |
| 313 | + (errcode(ERRCODE_CANNOT_CONNECT_NOW), |
| 314 | + errmsg("the database system is not accepting connections"), |
| 315 | + errdetail("Hot standby mode is disabled."))); |
| 316 | + else if (reachedConsistency) |
311 | 317 | ereport(FATAL,
|
312 | 318 | (errcode(ERRCODE_CANNOT_CONNECT_NOW),
|
313 | 319 | errmsg("the database system is not yet accepting connections"),
|
314 |
| - errdetail("Consistent recovery state has not been yet reached."))); |
| 320 | + errdetail("Recovery snapshot is not yet ready for hot standby."), |
| 321 | + errhint("To enable hot standby, close write transactions with more than %d subtransactions on the primary server.", |
| 322 | + PGPROC_MAX_CACHED_SUBXIDS))); |
315 | 323 | else
|
316 | 324 | ereport(FATAL,
|
317 | 325 | (errcode(ERRCODE_CANNOT_CONNECT_NOW),
|
318 |
| - errmsg("the database system is not accepting connections"), |
319 |
| - errdetail("Hot standby mode is disabled."))); |
| 326 | + errmsg("the database system is not yet accepting connections"), |
| 327 | + errdetail("Consistent recovery state has not been yet reached."))); |
320 | 328 | break;
|
321 | 329 | case CAC_SHUTDOWN:
|
322 | 330 | ereport(FATAL,
|
|
0 commit comments