* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2019 PgPool Global Development Group
+ * Copyright (c) 2003-2020 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
static bool
is_cache_empty(POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend)
{
- /*
- * If SSL is enabled, we need to check SSL internal buffer is empty or not
- * first.
- */
- if (pool_ssl_pending(frontend))
- return false;
-
- if (!pool_read_buffer_is_empty(frontend))
- return false;
+ /* Are we suspending reading from frontend? */
+ if (!pool_is_suspend_reading_from_frontend())
+ {
+ /*
+ * If SSL is enabled, we need to check SSL internal buffer is empty or not
+ * first.
+ */
+ if (pool_ssl_pending(frontend))
+ return false;
+ if (!pool_read_buffer_is_empty(frontend))
+ return false;
+ }
return is_backend_cache_empty(backend);
}
* pgpool: a language independent connection pool server for PostgreSQL
* written by Tatsuo Ishii
*
- * Copyright (c) 2003-2019 PgPool Global Development Group
+ * Copyright (c) 2003-2020 PgPool Global Development Group
*
* Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby
*/
for (;;)
{
+ /* check if there's any pending data */
+ if (!pool_ssl_pending(backend) && pool_read_buffer_is_empty(backend))
+ {
+ pool_set_timeout(timeout);
+ if (pool_check_fd(backend) != 0)
+ {
+ ereport(DEBUG1,
+ (errmsg("inject_cached_message: select shows no pending data")));
+ pool_set_timeout(-1);
+ break;
+ }
+ pool_set_timeout(-1);
+ }
+
pool_read(backend, &kind, 1);
ereport(DEBUG1,
(errmsg("inject_cached_message: push message kind: '%c'", kind)));
buf = pool_read2(backend, ntohl(len) - sizeof(len));
pool_push(backend, buf, ntohl(len) - sizeof(len));
}
-
- /* check if there's any pending data */
- if (!pool_ssl_pending(backend) && pool_read_buffer_is_empty(backend))
- {
- pool_set_timeout(timeout);
- if (pool_check_fd(backend) != 0)
- {
- ereport(DEBUG1,
- (errmsg("inject_cached_message: select shows no pending data")));
- pool_set_timeout(-1);
- break;
- }
- pool_set_timeout(-1);
- }
}
/*