pgpool2.git / summary / log / commit / refs
commit bb41a1e55d59f842d8b97cdbb6c973c1989904aa
Author: Tatsuo Ishii <ishii@postgresql.org>
Date: Tue Jun 28 01:35:53 2016 +0000
Fix confusing error messages.
pool_read() does not emit error messages when read(2) returns -1 if
fail_over_on_backend_error is off. In any case the cause of error
should be emitted. I do not back port this because it's a too trivial
enhancement.
src/utils/pool_stream.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/utils/pool_stream.c b/src/utils/pool_stream.c
index 7249b3be2..39903bf51 100644
--- a/src/utils/pool_stream.c
+++ b/src/utils/pool_stream.c
@@ -207,21 +207,17 @@ int pool_read(POOL_CONNECTION *cp, void *buf, int len)
cp->socket_state = POOL_SOCKET_ERROR;
if (cp->isbackend)
{
+ ereport(ERROR,
+ (errmsg("unable to read data from DB node %d",cp->db_node_id),
+ errdetail("socket read failed with an error \"%s\"", strerror(errno))));
+
/* if fail_over_on_backend_error is true, then trigger failover */
if (pool_config->fail_over_on_backend_error)
{
notice_backend_error(cp->db_node_id, true);
+
+ /* If we are in the main process, we will not exit */
child_exit(POOL_EXIT_AND_RESTART);
- /* we are in main process */
- ereport(ERROR,
- (errmsg("unable to read data from DB node %d",cp->db_node_id),
- errdetail("socket read failed with an error \"%s\"", strerror(errno))));
- }
- else
- {
- ereport(ERROR,
- (errmsg("unable to read data from DB node %d",cp->db_node_id),
- errdetail("socket read failed with an error \"%s\"", strerror(errno))));
}
}
else
[parent: a01624f49870]